sips -g all 源文件路径
有文件满足下面的条件
pixelWidth: 1024
pixelHeight: 1024
typeIdentifier: public.png
format: png
formatOptions: default
dpiWidth: 72.000
dpiHeight: 72.000
samplesPerPixel: 4
bitsPerSample: 8
hasAlpha: yes//非常重要
space: RGB
profile: sRGB IEC61966-2.1//非常重要
以上条件不满足可能在有些设备上不显示 ICON
#!/bin/bash iconset='AppIcon.appiconset'; if [ ! -d $iconset ] then mkdir $iconset; fi cat <<EOF > "$iconset/Contents.json" { "images" : [ { "size" : "20x20", "idiom" : "iphone", "filename" : "Icon40.png", "scale" : "2x" }, { "size" : "20x20", "idiom" : "iphone", "filename" : "Icon60.png", "scale" : "3x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "Icon29.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "Icon58.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "Icon87.png", "scale" : "3x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "Icon80.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "Icon120.png", "scale" : "3x" }, { "size" : "57x57", "idiom" : "iphone", "filename" : "Icon57.png", "scale" : "1x" }, { "size" : "57x57", "idiom" : "iphone", "filename" : "Icon114.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "Icon120.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "Icon180.png", "scale" : "3x" }, { "size" : "20x20", "idiom" : "ipad", "filename" : "Icon20.png", "scale" : "1x" }, { "size" : "20x20", "idiom" : "ipad", "filename" : "Icon40.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "Icon29.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "Icon58.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon40.png", "scale" : "1x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon80.png", "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon76.png", "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon152.png", "scale" : "2x" }, { "size" : "83.5x83.5", "idiom" : "ipad", "filename" : "Icon167.png", "scale" : "2x" }, { "size" : "1024x1024", "idiom" : "ios-marketing", "filename" : "Icon1024.png", "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } } EOF list="20 40 60 29 87 80 120 57 114 58 76 152 167 180 1024"; for i in $list; do icon="${iconset}/Icon${i}.png" sips --matchTo '/System/Library/ColorSync/Profiles/sRGB Profile.icc' -Z $i $1 --out "$icon"; done sips --matchTo '/System/Library/ColorSync/Profiles/sRGB Profile.icc' -Z 512 $1 --out iTunesArtwork; sips --matchTo '/System/Library/ColorSync/Profiles/sRGB Profile.icc' -Z 1024 $1 --out iTunesArtwork@2x;