Skip to content

Instantly share code, notes, and snippets.

@lincerely
Created November 20, 2022 22:10
Show Gist options
  • Select an option

  • Save lincerely/b7f4e61e3063e6edbff370103c781091 to your computer and use it in GitHub Desktop.

Select an option

Save lincerely/b7f4e61e3063e6edbff370103c781091 to your computer and use it in GitHub Desktop.
convert any image to .icns with imagemagick on macOS
#!/usr/bin/env bash
# convert any image to .icns with imagemagick
# refs: https://www.imagemagick.org/Usage/resize/#fill
# https://www.imagemagick.org/Usage/thumbnails/#fit_summery
if [ $# -ne 1 ]; then
echo usage: img2icns.sh IMG
exit 1
fi
magick "$1" -resize 512x512 -gravity center \
-background transparent -extent 512x512 "$1".tiff && \
tiff2icns "$1".tiff && \
rm "$1".tiff
@lincerely
Copy link
Author

better alternative: just convert *.ico icons.icns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment