Skip to content

Instantly share code, notes, and snippets.

@vampjaz
Created April 30, 2018 21:13
Show Gist options
  • Save vampjaz/c8013f800d43ab6d467368751d596be8 to your computer and use it in GitHub Desktop.
Save vampjaz/c8013f800d43ab6d467368751d596be8 to your computer and use it in GitHub Desktop.
makes still pngs into a still gif (for nitro emote server packing)
#!/bin/sh
## all the input files should be png files in the current directory
# dependencies: imagemagick convert utility
mkdir -p temp
mkdir -p output
for file in *.png
do echo "Converting $file"
cp "$file" temp/1.png
cp "$file" temp/2.png
output="output/$(echo $file | cut -d. -f1).gif"
convert temp/*.png "$output"
rm -f temp/*.png
size=$(du -k "$output" | cut -f1)
if [[ $size > 255 ]]
then echo "\x1B[31mWarning: $output is too large\x1B[0m"
fi
done
rm -rf temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment