0

I had a problem turning a Postscript into a PNG

the_canvas.update()
the_canvas.postscript(file="filename.ps", colormode='color')
psimage=Image.open('filename.ps')
psimage.save('filename.png')

The Entire Code:

from tkinter import *
from PIL import ImageTk, Image
from PIL import ImageGrab
from datetime import date

root = Tk()



width_i= root.winfo_screenwidth()
height_i= root.winfo_screenheight()

today = date.today()

root.geometry("%dx%d" % (width_i, height_i))
root.title("Fullscreen")

the_canvas = Canvas(root, width= 1280, height = 720, bg= "white", highlightthickness=0)


the_image = ImageTk.PhotoImage(Image.open("GUI/GUI materials/MAT.PNG"))
the_canvas.create_image(0,0, image=the_image, anchor=NW)

the_label = Label(root, text= " "+str(today.day) +"-"+ str(today.month) +"-"+ str(today.year)+" ", fg= "white" ,bg= "black", font = ("Helvetica",36))
the_labelw = the_canvas.create_window(645,650, window=the_label)

the_canvas.pack(expand=True,fill=BOTH)

the_canvas.update()
the_canvas.postscript(file="filename.ps", colormode='color')
psimage=Image.open('filename.ps')
psimage.save('filename.png')

root.mainloop()

Please help!

Pokero
  • 43
  • 2
  • 9
  • What happens when you run the code? Does it give you an error? If so, please post the full error traceback. – TheLizzard Jul 07 '21 at 11:47
  • @TheLizzard line 332, in load self.im = Ghostscript(self.tile, self.size, self.fp, scale) line 134, in Ghostscript raise OSError("Unable to locate Ghostscript on paths") OSError: Unable to locate Ghostscript on paths – Pokero Jul 07 '21 at 13:28
  • Look at [this](https://stackoverflow.com/a/63262348/11106801). It looks like you have to download/install ghost script that can read the postscript file. – TheLizzard Jul 07 '21 at 13:32
  • Okay thanks, i'll try :) – Pokero Jul 07 '21 at 14:12
  • Does it still raise the same error? Did you include the `EpsImagePlugin.gs_windows_binary = r"C:\...\gs\gs9.52\bin\gswin64c"` (where the path is to the executable of ghost script)? – TheLizzard Jul 07 '21 at 14:41
  • Yes I did and it works, Thanks! – Pokero Jul 09 '21 at 08:13

0 Answers0