Skip to content

Instantly share code, notes, and snippets.

@ikey4u
Created February 27, 2020 03:36
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikey4u/659f38b4d7b3484d0b55de85a55a8154 to your computer and use it in GitHub Desktop.
Save ikey4u/659f38b4d7b3484d0b55de85a55a8154 to your computer and use it in GitHub Desktop.
Generate Mac icns icon from svg using inkscape
inkscape=/Applications/Inkscape.app/Contents/MacOS/inkscape
insvg=burpicon.svg
output=burp
outdir=${output}.iconset
mkdir $outdir
for sz in 16 32 128 256 512
do
echo "[+] Generete ${sz}x${sz} png..."
$inkscape --without-gui --export-file ${outdir}/icon_${sz}x${sz}.png -w $sz -h $sz $insvg
$inkscape --without-gui --export-file ${outdir}/icon_${sz}x${sz}@2x.png -w $((sz*2)) -h $((sz*2)) $insvg
done
iconutil --convert icns --output ${output}.icns ${outdir}
echo "[v] The icon is saved to ${output}.icns."
rm -rf ${outdir}
@axeldeau
Copy link

axeldeau commented Apr 10, 2023

This works with latest version of inkscape, remove the "--without-gui" and change the "--export-file" with "--export-filename"

@eagleoflqj
Copy link

insvg=$1
output=$2

outdir=${output}.iconset
mkdir $outdir
for sz in 16 32 128 256 512
do
    echo "[+] Generete ${sz}x${sz} png..."
    inkscape --export-filename=${outdir}/icon_${sz}x${sz}.png -w $sz -h $sz $insvg
    inkscape --export-filename=${outdir}/icon_${sz}x${sz}@2x.png -w $((sz*2)) -h $((sz*2)) $insvg
done
iconutil --convert icns --output ${output}.icns ${outdir}
echo "[v] The icon is saved to ${output}.icns."
rm -rf ${outdir}

@MatiDomVal
Copy link

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