Skip to content

Instantly share code, notes, and snippets.

@rishipr
Created May 11, 2020 18:26
Show Gist options
  • Save rishipr/0a279238581e50b1d4f62f215c59fa49 to your computer and use it in GitHub Desktop.
Save rishipr/0a279238581e50b1d4f62f215c59fa49 to your computer and use it in GitHub Desktop.
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