├── .DS_Store ├── AppIcon ├── .DS_Store ├── AppIcon.sh └── icon.png ├── LaunchImage ├── .DS_Store └── AppLaunch.sh ├── README.md └── md_res ├── AppIcon.png ├── AppIcon2.png ├── AppIcon3.png └── LaunchImage.png /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuOtto/MacImagesetGenerator/72ac2eb102dd5fdf177dd4fdec18333554593096/.DS_Store -------------------------------------------------------------------------------- /AppIcon/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuOtto/MacImagesetGenerator/72ac2eb102dd5fdf177dd4fdec18333554593096/AppIcon/.DS_Store -------------------------------------------------------------------------------- /AppIcon/AppIcon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | iPhoneIconWithSize() { 4 | sips -Z $1 icon.png --out ./AppIcon/icon_$1x$1.png 5 | } 6 | 7 | iPadIconWithSize() { 8 | sips -Z $1 icon.png --out ./AppIcon/iPad_$1x$1.png 9 | } 10 | 11 | setContents(){ 12 | cat <./AppIcon/Contents.json 13 | { 14 | "images" : [ 15 | { 16 | "size" : "20x20", 17 | "idiom" : "iphone", 18 | "scale" : "2x", 19 | "filename" : "icon_40x40.png" 20 | }, 21 | { 22 | "size" : "20x20", 23 | "idiom" : "iphone", 24 | "scale" : "3x", 25 | "filename" : "icon_60x60.png" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "scale" : "2x", 31 | "filename" : "icon_58x58.png" 32 | }, 33 | { 34 | "size" : "29x29", 35 | "idiom" : "iphone", 36 | "scale" : "3x", 37 | "filename" : "icon_87x87.png" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "scale" : "2x", 43 | "filename" : "icon_80x80.png" 44 | }, 45 | { 46 | "size" : "40x40", 47 | "idiom" : "iphone", 48 | "scale" : "3x", 49 | "filename" : "icon_120x120.png" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "scale" : "2x", 55 | "filename" : "icon_120x120.png" 56 | }, 57 | { 58 | "size" : "60x60", 59 | "idiom" : "iphone", 60 | "scale" : "3x", 61 | "filename" : "icon_180x180.png" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "scale" : "1x", 67 | "filename" : "iPad_20x20.png" 68 | }, 69 | { 70 | "size" : "20x20", 71 | "idiom" : "ipad", 72 | "scale" : "2x", 73 | "filename" : "iPad_40x40.png" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "scale" : "1x", 79 | "filename" : "iPad_29x29.png" 80 | }, 81 | { 82 | "size" : "29x29", 83 | "idiom" : "ipad", 84 | "scale" : "2x", 85 | "filename" : "iPad_58x58.png" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "scale" : "1x", 91 | "filename" : "iPad_40x40.png" 92 | }, 93 | { 94 | "size" : "40x40", 95 | "idiom" : "ipad", 96 | "scale" : "2x", 97 | "filename" : "iPad_80x80.png" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "scale" : "1x", 103 | "filename" : "iPad_76x76.png" 104 | }, 105 | { 106 | "size" : "76x76", 107 | "idiom" : "ipad", 108 | "scale" : "2x", 109 | "filename" : "iPad_152x152.png" 110 | }, 111 | { 112 | "size" : "83.5x83.5", 113 | "idiom" : "ipad", 114 | "scale" : "2x", 115 | "filename" : "iPad_167x167.png" 116 | }, 117 | { 118 | "size" : "1024x1024", 119 | "idiom" : "ios-marketing", 120 | "scale" : "1x", 121 | "filename" : "icon_1024x1024.png" 122 | } 123 | ], 124 | "info" : { 125 | "version" : 1, 126 | "author" : "xcode" 127 | } 128 | } 129 | EOF 130 | } 131 | 132 | rm -r -f AppIcon 133 | mkdir AppIcon 134 | setContents 135 | for iPhoneSize in 40 58 60 80 87 120 180 1024 136 | do 137 | iPhoneIconWithSize $iPhoneSize 138 | done 139 | 140 | for iPadSize in 20 29 40 58 76 80 152 167 141 | do 142 | iPadIconWithSize $iPadSize 143 | done 144 | 145 | -------------------------------------------------------------------------------- /AppIcon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuOtto/MacImagesetGenerator/72ac2eb102dd5fdf177dd4fdec18333554593096/AppIcon/icon.png -------------------------------------------------------------------------------- /LaunchImage/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuOtto/MacImagesetGenerator/72ac2eb102dd5fdf177dd4fdec18333554593096/LaunchImage/.DS_Store -------------------------------------------------------------------------------- /LaunchImage/AppLaunch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | Contents(){ 4 | cat <./LaunchImage/Contents.json 5 | { 6 | "images" : [ 7 | { 8 | "extent" : "full-screen", 9 | "idiom" : "iphone", 10 | "subtype" : "2688h", 11 | "filename" : "Default1242x2688.png", 12 | "minimum-system-version" : "12.0", 13 | "orientation" : "portrait", 14 | "scale" : "3x" 15 | }, 16 | { 17 | "extent" : "full-screen", 18 | "idiom" : "iphone", 19 | "subtype" : "1792h", 20 | "filename" : "Default828x1792.png", 21 | "minimum-system-version" : "12.0", 22 | "orientation" : "portrait", 23 | "scale" : "2x" 24 | }, 25 | { 26 | "extent" : "full-screen", 27 | "idiom" : "iphone", 28 | "subtype" : "2436h", 29 | "filename" : "Default1125x2436.png", 30 | "minimum-system-version" : "11.0", 31 | "orientation" : "portrait", 32 | "scale" : "3x" 33 | }, 34 | { 35 | "extent" : "full-screen", 36 | "idiom" : "iphone", 37 | "subtype" : "736h", 38 | "filename" : "Default1242x2208.png", 39 | "minimum-system-version" : "8.0", 40 | "orientation" : "portrait", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "extent" : "full-screen", 45 | "idiom" : "iphone", 46 | "subtype" : "667h", 47 | "filename" : "Default750x1334.png", 48 | "minimum-system-version" : "8.0", 49 | "orientation" : "portrait", 50 | "scale" : "2x" 51 | }, 52 | { 53 | "extent" : "full-screen", 54 | "idiom" : "iphone", 55 | "filename" : "Default640x960.png", 56 | "minimum-system-version" : "7.0", 57 | "orientation" : "portrait", 58 | "scale" : "2x" 59 | }, 60 | { 61 | "extent" : "full-screen", 62 | "idiom" : "iphone", 63 | "subtype" : "retina4", 64 | "filename" : "Default640x1136.png", 65 | "minimum-system-version" : "7.0", 66 | "orientation" : "portrait", 67 | "scale" : "2x" 68 | } 69 | ], 70 | "info" : { 71 | "version" : 1, 72 | "author" : "xcode" 73 | } 74 | } 75 | EOF 76 | } 77 | 78 | setImage(){ 79 | sips -z 960 640 default.png --out ./LaunchImage/Default640x960.png 80 | sips -z 1136 640 default.png --out ./LaunchImage/Default640x1136.png 81 | sips -z 1334 750 default.png --out ./LaunchImage/Default750x1334.png 82 | sips -z 2436 1125 default.png --out ./LaunchImage/Default1125x2436.png 83 | sips -z 2208 1242 default.png --out ./LaunchImage/Default1242x2208.png 84 | sips -z 1792 828 default.png --out ./LaunchImage/Default828x1792.png 85 | sips -z 2688 1242 default.png --out ./LaunchImage/Default1242x2688.png 86 | } 87 | 88 | #调用函数 89 | mkdir LaunchImage 90 | Contents 91 | setImage 92 | 93 | 94 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 概述 2 | 之前用的一个批量导出APP图标和启动图的软件,今天发现收费了,于是自己造了个简单的轮子。 3 | 4 | ## 实现 5 | Mac上的`sips`命令,可以很方便的帮助用户修改图片尺寸 6 | 7 | Xcode里面的APP启动图资源包含两部分 8 | 1. 图片资源 9 | 2. 描述文件 10 | 11 | 所以这个脚本的功能就是两个 12 | 1. 生成描述文件`Contents.json` 13 | 2. 修改图片尺寸并关联描述文件 14 | 15 | ### 生成描述文件 16 | 使用`cat`命令生成描述文件 17 | 18 | ``` 19 | setContents(){ 20 | cat <./AppIcon/Contents.json 21 | { 22 | "images" : [ 23 | { 24 | "size" : "20x20", 25 | "idiom" : "iphone", 26 | "scale" : "2x", 27 | "filename" : "icon_40x40.png" 28 | }, 29 | { 30 | "size" : "20x20", 31 | "idiom" : "iphone", 32 | "scale" : "3x", 33 | "filename" : "icon_60x60.png" 34 | }, 35 | ... 36 | EOF 37 | } 38 | ``` 39 | 40 | ### 修改图片尺寸 41 | ``` 42 | iconWithSize() { 43 | sips -Z $1 icon.png --out ./AppIcon/icon_$1x$1.png 44 | } 45 | ``` 46 | 47 | ### 函数调用 48 | ``` 49 | mkdir AppIcon 50 | setContents 51 | for size in 40 58 60 80 87 120 180 1024 52 | do 53 | iconWithSize $size 54 | done 55 | ``` 56 | 57 | ![](./md_res/AppIcon2.png) 58 | 59 | ![](./md_res/AppIcon3.png) 60 | 61 | ## 效果展示 62 | ![](./md_res/AppIcon.png?123) 63 | 64 | ![](./md_res/LaunchImage.png) 65 | 66 | ## 怎么使用 67 | ### AppIcon 68 | 下载对应的`sh`文件,放到你想导出图片的目录下,将你的原图命名为`icon.png`,然后在控制台中进入该目录,执行 69 | ``` 70 | sh AppIcon.sh 71 | ``` 72 | 73 | ### LaunchImage 74 | 下载对应的`sh`文件,放到你想导出图片的目录下,将你的原图命名为`default.png`,然后在控制台中进入该目录,执行 75 | ``` 76 | sh AppLaunch.sh 77 | ``` 78 | 79 | 就可以得到你要的资源啦。 80 | 81 | ## 更新日志 82 | ### 2019-04-28 83 | 更新生成`XR`和`XS Max`的启动图 84 | ### 2018-08-07 85 | 更新代码,使用`cat`命令替换`echo`生成Contents.json文件 86 | 感谢[@LinMaris](https://github.com/LinMaris)提供的思路 87 | 88 | ### 2018-06-24 89 | 更新`iPad`图标支持 90 | -------------------------------------------------------------------------------- /md_res/AppIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuOtto/MacImagesetGenerator/72ac2eb102dd5fdf177dd4fdec18333554593096/md_res/AppIcon.png -------------------------------------------------------------------------------- /md_res/AppIcon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuOtto/MacImagesetGenerator/72ac2eb102dd5fdf177dd4fdec18333554593096/md_res/AppIcon2.png -------------------------------------------------------------------------------- /md_res/AppIcon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuOtto/MacImagesetGenerator/72ac2eb102dd5fdf177dd4fdec18333554593096/md_res/AppIcon3.png -------------------------------------------------------------------------------- /md_res/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuOtto/MacImagesetGenerator/72ac2eb102dd5fdf177dd4fdec18333554593096/md_res/LaunchImage.png --------------------------------------------------------------------------------