Skip to content

Instantly share code, notes, and snippets.

@AnonymerNiklasistanonym
Created February 26, 2024 04:44
Show Gist options
  • Save AnonymerNiklasistanonym/361aa972926e87546767477d17a72efe to your computer and use it in GitHub Desktop.
Save AnonymerNiklasistanonym/361aa972926e87546767477d17a72efe to your computer and use it in GitHub Desktop.
Horizontally flip png images and overlay an png image on top of them, then convert the png images to an animated webp image
#!/usr/bin/env bash
# Horizontally flip png images and overlay an png image on top of them
for filename in frame_*.png
do
echo "Update $filename"
# Horizontal flip
magick "$filename" -flop "$filename"
# Add overlay image
magick convert "$filename" "../overlay.webp" -gravity Center -composite "$filename"
done
# Convert png images to an animated webp image
FILES=$(echo frame_*.png | sort)
echo "Merge $FILES"
magick $FILES -quality 50 -define webp:lossless=true animation.webp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment