How to create a .png/.jpg file with their size defined in Pillow module Python

166 views Asked by At

Expectations: I want to create a png/jpeg file based on the user input in in tkinter but I would need to use pillow to create the images. I want to create a png and jpg and of a certain size.

If I plainly create the file using:

with open('filename. jpg #for this example', 'x'):
    pass

Some Extra Info: It saves with 0kb which I have expected but I have no way to set the size of the image. If I create a png and jpg in Paint 3d they do take up some I am guessing from the size.

Needs: I would need to create a png/jpg file using Pillow with a set width and height, and also fill in the background of the image with any color, let just say as red

0

There are 0 answers