Just as the question says, how do i create an image file of a triangle in which the sides and the angles are inputted.
The current solution i am using is with turtle library
forward(s1)
left(180-c)
forward(s2)
left(180-a)
forward(s3)
ts = turtle.getcanvas()
ts.postscript(file="file.ps")
Now this works, but it outputs the image in a ps file. Since i want it in a image form(like png/jpg/pil image), i need to convert it to it. So i found that to do that you can use
img = Image.open("file.ps")
img.save("file.png")
But that says it "unable to locate Ghostscript on paths" But since i cannot install ghostscript(Due to reasons) on my device, i cant convert it to am image form. So my question is, is there any library or any way to create an image file of a triangle using just the sides and angles. No idea how i could do it in PIL, as i need coordinates for the vertices, and i have no clue how to get the coordinates of the vertices. Also another problem with Turtle is that it creates a new window to make the image. So preferably, i want the image creation to happen in the background. Any way to do this?
Edit: Code i am currently using to make the file:
def trianglesss(s1,s2,s3):
a = s1
b = s2
c = s3
a1 = round(math.degrees(math.acos(((b**2)+(c**2)-(a**2))/(2*b*c))))
b1 = round(math.degrees(math.acos(((c**2)+(a**2)-(b**2))/(2*a*c))))
c1 = round(math.degrees(math.acos(((b**2)+(a**2)-(c**2))/(2*a*b))))
turtle.tracer(0,0)
turtle.pendown()
turtle.speed('fastest')
hideturtle()
forward(s1)
left(180-c1)
forward(s2)
left(180-a1)
forward(s3)
turtle.update()
ts = turtle.getcanvas()
ts.postscript(file="file.eps")
bye()
trisssimg = Image.open("file.eps")
trisssimg.save("Trisss.jpg")
trianglesss(20,20,20)
#Calculating angles using the formula from:
#https://www.mathsisfun.com/algebra/trig-solving-sss-triangles.html