Code: Select all
from PIL import Image, EpsImagePlugin
import os
import turtle
EpsImagePlugin.gs_windows_binary=r'C:\\Program Files\\gs\\gs10.01.2\bin\\gswin64c'
point=turtle.Turtle(); point.speed(0); point.color('yellow')
point.penup(); point.sety(- 6*25); point.pendown()
point.begin_fill()
point.circle(6*25, steps=6)
point.end_fill()
point.hideturtle()
screen=turtle.Screen(); screen.bgcolor('black')[turtle image](https://i.sstatic.net/1t5V0.png)
board=screen.getcanvas(); board.postscript(file="test_drawing.eps")
Image.open("test_drawing.eps").save("test_drawing.jpg", "JPEG")
Image.open(r'C:\\Users\\parth\Desktop\\coding\\test_drawing.jpg').show()[saved image](https://i.sstatic.net/asQUQ.png)
Image.open(r'C:\\Users\\parth\Desktop\\coding\\test_drawing.jpg').rotate(45, fillcolor='black', expand=True).show()[the output i want but with a complete black bg](https://i.sstatic.net/cYpF6.png)
os.remove(path=r'C:\\Users\\parth\Desktop\\coding\\test_drawing.jpg')