Created
May 11, 2020 18:26
-
-
Save rishipr/0a279238581e50b1d4f62f215c59fa49 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
from PIL import Image | |
def main(): | |
# iterate through the names of contents of the folder | |
path = './images/' | |
for image_path in os.listdir(path): | |
input_path = os.path.join(path, image_path) | |
if not input_path.endswith('.jpg'): | |
continue | |
img = Image.open(input_path).resize((210, 210), Image.ANTIALIAS) | |
img.save(input_path) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment