←back to thread

2039 points Gadiguibou | 1 comments | | HN request time: 1.345s | source
Show context
strogonoff ◴[] No.36495008[source]
You can use sips together with iconutil to generate a complete .icns file for your app from a single 1024 by 1024 PNG without any third party software:

    mkdir MyIcon.iconset
    cp Icon1024.png MyIcon.iconset/icon_512x512@2x.png
    sips -z 16 16     Icon1024.png --out MyIcon.iconset/icon_16x16.png
    sips -z 32 32     Icon1024.png --out MyIcon.iconset/icon_16x16@2x.png
    sips -z 32 32     Icon1024.png --out MyIcon.iconset/icon_32x32.png
    sips -z 64 64     Icon1024.png --out MyIcon.iconset/icon_32x32@2x.png
    sips -z 128 128   Icon1024.png --out MyIcon.iconset/icon_128x128.png
    sips -z 256 256   Icon1024.png --out MyIcon.iconset/icon_128x128@2x.png
    sips -z 256 256   Icon1024.png --out MyIcon.iconset/icon_256x256.png
    sips -z 512 512   Icon1024.png --out MyIcon.iconset/icon_256x256@2x.png
    sips -z 512 512   Icon1024.png --out MyIcon.iconset/icon_512x512.png
    iconutil -c icns MyIcon.iconset
As a bonus, generate .ico with ffmpeg:

    ffmpeg -i MyIcon.iconset/icon_256x256.png icon.ico
Incidentally, does anyone know enough about the way sips scales PNGs to confirm that it makes sense to create the 16px version straight from 1024px, as opposed to basing it off 32px (and all the way up)? I.e., is it better to downscale in fewer steps (as currently) or in smaller steps?
replies(4): >>36495648 #>>36500938 #>>36502128 #>>36505339 #
1. gpspake ◴[] No.36505339[source]
Perfect timing. I need to generate an.icns today and I'm going to try this. Thanks :)