Last active
November 13, 2018 04:50
-
-
Save rodel77/f7a36b2bef33943167f0ef1fae11f992 to your computer and use it in GitHub Desktop.
Python batch resizing (Targeted to 32x32 & requires PIL)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import PIL | |
from PIL import Image | |
if not os.path.exists("resized"): | |
os.makedirs("resized") | |
for (dirpath, dirnames, files) in os.walk("."): | |
for _file in files: | |
if ".png" in _file: | |
img = Image.open(_file) | |
img = img.resize((32, 32), Image.NEAREST) | |
img.save("resized/"+_file) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment