Skip to content

Instantly share code, notes, and snippets.

@alonlavian
Created April 28, 2019 19:32
Show Gist options
  • Save alonlavian/75da6648a4ab64735e4e76e8f192c7ef to your computer and use it in GitHub Desktop.
Save alonlavian/75da6648a4ab64735e4e76e8f192c7ef to your computer and use it in GitHub Desktop.
crops all jpg in a folder and saves all cropped faces to the destination folder
original_images_dir = os.fsencode('/content/drive/My Drive/Google Photos/2019')
cropped_images_lib = '/content/drive/My Drive/CropMix/'
for path, dirs, files in os.walk(original_images_dir):
for file in files:
image_name = os.fsdecode(file)
if image_name.endswith(".jpg"):
image_path = os.path.join(path,file)
crop_faces(image_path,image_name,cropped_images_lib)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment