Created
November 28, 2020 04:00
-
-
Save 143mailliw/dcce5dae512761236f5f17d3c71016f3 to your computer and use it in GitHub Desktop.
overlay the discord logo animation over an image
This file contains 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
echo Creating GIF... | |
if [ -f "$1" ]; then | |
mkdir out | |
echo Cropping + resize to 400x400 | |
convert $1 -trim t1.png | |
convert t1.png -resize 400x400 t2.png | |
echo Extracting video frames | |
ffmpeg -hide_banner -loglevel panic -i connecting.webm out/a%03d.png | |
echo Chroma keying frames | |
find out/. -name "*.png" -exec convert "{}" -fuzz 20% -transparent "#000000" "{}" \; | |
echo Converting frames to 24bit color | |
find out/. -name "*.png" -exec convert {} +dither -colors 256 -background black -alpha background PNG8:{} \; | |
echo Compositing logo over input | |
find out/. -name "*.png" -exec composite -compose Dst_Over ./t2.png "{}" "{}" \; | |
echo Combining frames into final gif | |
convert -delay 2 -dispose previous out/a*.png output.gif | |
echo Cleaning up | |
rm t2.png | |
rm t1.png | |
rm -r out | |
echo Saved as output.gif | |
else | |
echo ERROR: Input file does not exist, cannot continue. | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment