Created
October 31, 2018 21:47
-
-
Save charlesreid1/58dfa3d2ead5e8cf293086c3a50b9192 to your computer and use it in GitHub Desktop.
Make a gif file that zooms in to a static jpg/png image (powered by ImageMagick)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Panned and zoomed animation | |
# Mark Setchell | |
# https://stackoverflow.com/a/33467267 | |
CONVERTME="full.jpg" | |
steps=60 | |
# Final x offset from top left | |
finalx=2070 | |
# Final y offset from top left | |
finaly=570 | |
# Initial & Final width | |
initw=4000 | |
finalw=1000 | |
# Initial & Final height | |
inith=3200 | |
finalh=800 | |
# Remove anything from previous attempts | |
rm frame-*jpg 2> /dev/null | |
for i in $(seq 0 $steps); do | |
((x=finalx*i/steps)) | |
((y=finaly*i/steps)) | |
((w=initw-(i*(initw-finalw)/steps))) | |
((h=inith-(i*(inith-finalh)/steps))) | |
echo $i,$x,$y,$w,$h | |
name=$(printf "frame-%03d.jpg" $i) | |
convert $CONVERTME -crop ${w}x${h}+${x}+${y} -resize 200x160 "$name" | |
done | |
convert -delay 10 frame* anim.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment