Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for alpha channel, more flexible options #7

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9d790ff
added support to remove alpha channel on ios
Nov 10, 2015
093cbe8
support "no ios filename prefix", support android "no folder" ex for …
Nov 10, 2015
5886d5c
updated readme
Nov 10, 2015
79eb811
added svg support, added image mimetype check,updated readme
Nov 10, 2015
328c8b3
add parameters to force square icon (eg when ratio!=1:1)
Nov 11, 2015
3e08804
using image magick "convert" to convert svg to png instead of node mo…
Nov 11, 2015
706f6c7
fix new name when svg
Nov 11, 2015
c56d97f
reformatting to suit master`s needs
Nov 12, 2015
61599c5
added svg info in readme
Nov 12, 2015
7adeb68
update image-size to natively support svg
Nov 12, 2015
83d1a97
added density for conversions of small svg to bigger png
Nov 27, 2015
a81238b
added serial processing(optionnal) to prevent high cpu usage
Dec 1, 2015
cb0cf06
updated package for image-size dep
Apr 7, 2016
58873f6
add ios option to convert grayscale to rgb
Apr 7, 2016
10c5235
added android playstore icon background
May 19, 2016
86d2962
add launchImages support
markdowney Oct 11, 2016
df0250c
add command line support for launch image folder
markdowney Oct 11, 2016
54b7496
add contents.json output
markdowney Oct 11, 2016
93b73be
edit config and add support for background color and logo scale args
markdowney Oct 12, 2016
2fa69c2
fix typos
markdowney Oct 12, 2016
5cbcdb7
format output json
markdowney Oct 12, 2016
0d1d27a
remove ios prefix and add logo arg
markdowney Oct 12, 2016
00d5c3d
fix android file names and bg alias
markdowney Oct 17, 2016
0343c7e
remove android store image from config
markdowney Nov 3, 2016
a051e00
fix itunesArtWork to flatten
Nov 16, 2016
57cbf04
Merge branch 'master' of git://github.com/bakery/mobile-icon-resizer …
Mar 5, 2019
515a1f1
git push origin masterMerge branch 'bakery-master'
Mar 5, 2019
550aa5a
some fixes and adjustments after merge
Mar 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ dump.rdb
/nbproject/private/
/node_modules/

*.code-workspace

lib-cov
*.seed
*.log
Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Mobile Icon Resizer

This tool can be used to resize iOS and Android application icons in batch. That is, given a 1024x1024 icon, this tool will generate all necessary icon sizes.
This tool can be used to resize iOS and Android application icons in batch. That is, given a 1024x1024 icon or an svg image, this tool will generate all necessary icon sizes.

## Dependencies

Expand Down Expand Up @@ -35,7 +35,9 @@ The `resize()` function's `options` argument takes the following optional parame

* **platformsToBuild**: For which platforms should the icons be resized. Comma-separated list. Possible values ['ios', 'android']
* **originalIconFilename**: The original image's relative path and filename such as '../someIcon.png'. Default: 'appicon_1024.png'.
* **iosFilenamePrefix**: The prefix of the iOS image files. Default: 'Icon'.
* **iosFilenamePrefix**: The prefix of the iOS image files. Default: 'Icon'. Could be empty (empty string) if you want to manage it in your config.js.
* **iosRemoveAlpha**: Remove Alpha channel from your png for iTunes
* **iosBackgroundColor**: The color of the background when removeAlpha = true
* **iosOutputFolder**: The output folder for the iOS icons. Default: '.'.
* **androidOutputFolder**: The output folder for the Android icons. Default: '.'.
* **androidOutputFilename**: The output file name for the Android icons.
Expand All @@ -44,6 +46,7 @@ The `resize()` function's `options` argument takes the following optional parame
* **convertBin**: *Windows machines only*. See [Windows Support](#windows-support) below. Default `convert`.



### Standalone Application

You can run the tool as an application like this:
Expand Down Expand Up @@ -96,6 +99,17 @@ Here's an example to generate the 512x512 app icon that should be submitted to t
"size": "512x512",
"folder" : "WEB"
}
**`filename`**

This is the way to override default file name. You can also provide an empty folder name so it will be saved in the platform's root

Here's an example to generate a file with a custom name:

{
"size": "512x512",
"folder" : "",
"filename":"my-custom-named-file.png"
}

**`baseRatio`**

Expand Down Expand Up @@ -163,6 +177,11 @@ Example:
"baseRatio" : "4",
"folder" : "drawable-xxxhdpi"
},
{
"size": "512x512",
"folder" : "",
"filename":"playstore-icon.png"
},
{
"size": "512x512",
"folder" : "WEB"
Expand Down
246 changes: 188 additions & 58 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,140 +1,270 @@
var config = {
iOS: {
iOSIcons: {
"images": [
// iPad Settings
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "-Small.png",
"filename" : "Icon-App-29x29.png",
"scale" : "1x"
},
// iPad Retina Settings or iPhone Settings
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "-Small@2x.png",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
// iPhone Retina Settings
{
"size" : "40x40",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "-40@2x.png",
"scale" : "2x"
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
// iPad Spotlight
{
"size" : "57x57",
"size" : "40x40",
"idiom" : "iphone",
"filename" : ".png",
"filename" : "Icon-App-40x40.png",
"scale" : "1x"
},
// iPhone Spotlight
{
"size" : "57x57",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "@2x.png",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
// iPhone Retina Spotlight
{
"size" : "60x60",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "-60@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "-Small-1.png",
"scale" : "1x"
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
// iPhone icon
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "-Small@2x-1.png",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
// iPhone Retina icon
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "-40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "-40@2x-1.png",
"scale" : "2x"
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
// iPad icon
{
"size" : "50x50",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "-Small-50.png",
"filename" : "Icon-App-76x76.png",
"scale" : "1x"
},
// iPad Retina icon
{
"size" : "50x50",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "-Small-50@2x.png",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
// iPad Pro
{
"size" : "72x72",
"idiom" : "ipad",
"filename" : "-72.png",
"scale" : "1x"
"idiom":"ipad",
"size":"83.5x83.5",
"scale":"2x",
"filename":"Icon-App-83.5x83.5@2x.png"
},
// iTunes artwork
{
"size" : "72x72",
"idiom" : "ipad",
"filename" : "-72@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"size" : "512x512",
"idiom" : "ipad",
"filename" : "-76.png",
"filename" : "iTunesArtwork.png",
"scale" : "1x"
},
// iTunes artwork
{
"size" : "76x76",
"size" : "512x512",
"idiom" : "ipad",
"filename" : "-76@2x.png",
"filename" : "iTunesArtwork@2x.png",
"scale" : "2x"
}
},
]
},
android: {
"images" : [
{
"baseRatio" : "3/4",
"folder" : "drawable-ldpi"
"folder" : "mipmap-ldpi"
},
{
"baseRatio" : "1",
"folder" : "drawable-mdpi"
"folder" : "mipmap-mdpi"
},
{
"baseRatio" : "4/3",
"folder" : "drawable-tvdpi"
"folder" : "mipmap-tvdpi"
},
{
"baseRatio" : "1.5",
"folder" : "drawable-hdpi"
"folder" : "mipmap-hdpi"
},
{
"baseRatio" : "2",
"folder" : "drawable-xhdpi"
"folder" : "mipmap-xhdpi"
},
{
"baseRatio" : "3",
"folder" : "drawable-xxhdpi"
"folder" : "mipmap-xxhdpi"
},
{
"baseRatio" : "4",
"folder" : "drawable-xxxhdpi"
"folder" : "mipmap-xxxhdpi"
},
{
// Image to upload to the Play Store
"size": "512x512",
"folder" : "WEB"
}
]
},
iOSLaunchImages: {
"images": [
// iPhone 6Plus
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "Default-Portrait-736h@3x.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "3x",
"size" : {
"width" : 1242,
"height" : 2208
}
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "Default-Landscape-736h@3x.png",
"minimum-system-version" : "8.0",
"orientation" : "landscape",
"scale" : "3x",
"size" : {
"width" : 2208,
"height" : 1242
}
},
// iPhone 6
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "Default-Portrait-667h@2x.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x",
"size" : {
"width" : 750,
"height" : 1334
}
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "Default-Landscape-667h@2x.png",
"minimum-system-version" : "8.0",
"orientation" : "landscape",
"scale" : "2x",
"size" : {
"width" : 1334,
"height" : 750
}
},
// iPhone 5, no landscape
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"filename" : "Default-Portrait-568h@2x.png",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x",
"size" : {
"width" : 640,
"height" : 1136
}
},
// iPhone 4S, no landscape
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "Default-Portrait@2x.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x",
"size" : {
"width" : 640,
"height" : 960
}
},
// iPad non-Retina
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"minimum-system-version" : "7.0",
"filename" : "Default-768x1004.png",
"scale" : "1x",
"size" : {
"width" : 768,
"height" : 1004
}
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"minimum-system-version" : "7.0",
"filename" : "Default-1024x748.png",
"scale" : "1x",
"size" : {
"width" : 1024,
"height" : 748
}
},
// iPad Retina
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"minimum-system-version" : "7.0",
"filename" : "Default-1536x2008.png",
"scale" : "2x",
"size" : {
"width" : 1536,
"height" : 2008
}
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"minimum-system-version" : "7.0",
"filename" : "Default-2048x1496.png",
"scale" : "2x",
"size" : {
"height" : 1496,
"width" : 2048
}
},
]
}
};

Expand Down
Loading