Home > Enterprise >  'Exporting' a tkinter canvas to .png with Pillow and results in extremely low resolution
'Exporting' a tkinter canvas to .png with Pillow and results in extremely low resolution

Time:04-30

I'm trying to 'export' a tkinter canvas to a png file, as in this answer: enter image description here

I tried fiddling with the arguments (dpi, quality, compression_level) of both the open and the save methods, with no luck.

CodePudding user response:

According to the tkdoc on pagewidth or pageheight of .postscript():

Specifies that the Postscript should be scaled in both x and y so that the printed area is size high on the Postscript page. Size consists of a floating-point number followed by c for centimeters, i for inches, m for millimeters, or p or nothing for printer's points (1/72 inch). Defaults to the height of the printed area on the screen. If both -pageheight and -pagewidth are specified then the scale factor from -pagewidth is used (non-uniform scaling is not implemented).

# set the output width to 1000 pixels
canvas.postscript(file='./' fileName '.eps', colormode='color', pagewidth=1000)
  • Related