Skip to content

Instantly share code, notes, and snippets.

@travisjungroth
Last active July 14, 2022 16:17
Show Gist options
  • Save travisjungroth/632a51dbd76c6c71cfda991ff9c99793 to your computer and use it in GitHub Desktop.
Save travisjungroth/632a51dbd76c6c71cfda991ff9c99793 to your computer and use it in GitHub Desktop.
Script to convert image files to the Slack suggest format: 128x128 PNG with transparent background.
#!/bin/zsh
# this requires imagemagick to run
# brew install imagemagick && brew install ghostscript
# on Mac, download then run `mv ~/Downloads/emojify /user/local/bin/emojify`
# emojify file [output-name]
# examples
# emojify ~/Downloads/img.png winky-face
# emojify ~/Downloads/winky-face.jpg
# emojify ~/Downloads/winky-face.png (this will overwrite, since it's a PNG)
if [[ "${2}" != "" ]]
then
output="${1:h}/${2}".png
else
output="$1:r".png
fi
convert -background none -gravity center $1 -resize 128x128 -extent 128x128 $output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment