Skip to content

Instantly share code, notes, and snippets.

@ubermajestix
Created April 23, 2016 22:28
Show Gist options
  • Save ubermajestix/7276616697bfc3933bf8892137c2c5c9 to your computer and use it in GitHub Desktop.
Save ubermajestix/7276616697bfc3933bf8892137c2c5c9 to your computer and use it in GitHub Desktop.
Imagemagick Commands to shrink gif dimensions and file size to fit Slack's emoji policy (128x128 and 64k max)
# Recommended in docs to build a new gif from the source
for f in *.gif; do convert "$f" -coalesce ${f%gif}coal.gif; done
# Resize to 128x128. All images were the same size
for f in *.coal.gif; do convert -size 512x512 "$f" -resize 128x128 ${f%gif}small.gif; done
# This worked pretty well to get most of these gifs under 64k to upload to Slack
for f in *.small.gif; do convert "$f" -colors 32 -dither none -deconstruct -layers optimize ${f%small.gif}opt.gif; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment