Created
April 22, 2020 02:51
-
-
Save BernardoGO/2451ae8e96f63ade0e2e627fd3a3936e to your computer and use it in GitHub Desktop.
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
from PIL import Image | |
from glob import glob | |
import shutil | |
import random | |
import os | |
files = glob("500x500/*/*") | |
outputPath = "output3/" | |
newSize = [400, 400] | |
for x in files: | |
dirname = os.path.dirname(x) | |
img=Image.open(x) | |
new_img=img.resize((newSize[0],newSize[1])) | |
os.makedirs(outputPath+x.split("/")[-2]+"/", exist_ok=True) | |
new_img.save(outputPath+x.split("/")[-2]+"/"+os.path.basename(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment