Skip to content

Instantly share code, notes, and snippets.

@afeld
Last active December 29, 2020 20:40
Show Gist options
  • Save afeld/10d85bb67c3cc8c7b7bb to your computer and use it in GitHub Desktop.
Save afeld/10d85bb67c3cc8c7b7bb to your computer and use it in GitHub Desktop.
fix orientation for all images in an S3 bucket
# Reads from EXIF data and applies the appropriate rotation. Requires AWS CLI and ImageMagick.
# To use, replace `BUCKET` and run in your terminal.
mkdir -p BUCKET/upright
cd BUCKET
aws s3 sync s3://BUCKET .
find . -name "*.jpg" -exec convert {} -auto-orient upright/{} \;
aws s3 sync . s3://BUCKET --acl public-read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment