import Image
import os, sys
# adjust width and height to your needs
width = 800
height = 600
for root, dirs, files in os.walk('./'):
for name in files:
filename = os.path.join(root, name)
if filename.endswith('jpg'):
print filename
imin = Image.open(filename)
imout = imin.resize((width, height), Image.BICUBIC)
imout.save(filename)
Street Gamers Network
2 weeks ago


5 comments:
Good work, man! ;)
If you have 10 dirs on the same level but only want to do it to the files in for example gfx_a gfx_b and gfx_c dirs and not dirs not starting with gfx can you do that with the walk?
Hello, I wrote a program similar to yours with graphic interface, which let to resize all the images in a directory (including subfolders). If you like I can send you a link with the code.
Hello Peppe, in which language you wrote the program? if it's in Python, then I am really interested to get it with source code of course! Thanks.
python...of course. I used wxPython for the graphical interface and PIL to manage images. Here is my post with the core code and here is the complete script.
Post a Comment