euromili.blogg.se

Pil image resize commang
Pil image resize commang






pil image resize commang

The second script makes it 300 pixels wide and calculates the proportional height. The first one shrinks the image to 128x128 pixels. pip install Pillow Once Pillow is installed, we will need to create our new Python file: touch bulkimageresize.py At a minimum, we will need to add the following imports to our file: bulkimageresize. You must be in the same directory as the picture files for both of these scripts. To use Script #2: python resizescript.py yourfilenamehere.jpg To use Script #1: python resizescript.py yourfilenamehere.jpg

pil image resize commang

Ctrl+x to exit (say yes to save changes). Paste one of those blocks of code into the text editor.

#PIL IMAGE RESIZE COMMANG HOW TO#

Now, how to do this through the terminal. Img = img.resize((basewidth,hsize), Image.ANTIALIAS) Hsize = int((float(img.size)*float(wpercent))) Print "cannot create thumbnail for '%s'" % infileĪnd another example where you only have to specify the width (as the width variable): Outfile = os.path.splitext(infile) + ".thumbnail" It would be better if i could have all of them printed on my screen, without having to open them in some other program. Those examples use just the standard library. 1 why dont you want to save it Joran Beasley at 18:41 1 lets say i have 100 small pictures to look through. Since Ubuntu ships with Python, you can also use a Python script to achieve this with a little more control over what happens - see this stackoverflow question for example scripts.








Pil image resize commang