Skip to content

Instantly share code, notes, and snippets.

@JuhaKiili
Last active August 9, 2021 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JuhaKiili/aedac41b745977ed07483f2a05a5762c to your computer and use it in GitHub Desktop.
Save JuhaKiili/aedac41b745977ed07483f2a05a5762c to your computer and use it in GitHub Desktop.
# This code works for:
# 1. Single image
# 2. List of images
# 3. An archive with images
# 4. List of archives
# 5. Mix of everything above
# Defined by list of:
# 1. Public URIs
# 2. Private data store URIs
# 3. Local file paths
for image_path in valohai.inputs("my-images").paths():
# Do things per image
image = Image.open(image_path, mode="r")
image.thumbnail(size, Image.ANTIALIAS)
image.save(out_path, "JPEG")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment