Last active
August 21, 2018 07:05
-
-
Save alldne/4a2e187320c792531a86cbf7b3b4d16c to your computer and use it in GitHub Desktop.
Resizing icon (iOS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install -g mobile-icon-resizer | |
// https://github.com/muzzley/mobile-icon-resizer | |
// mobile-icon-resizer -i icon1024.png --platforms ios --config config.js --iosof ios | |
function make(width, scale) { | |
var name = width + ""; | |
var filename; | |
if (scale === 1) { | |
filename = "-" + name + ".png"; | |
} else { | |
filename = "-" + name + "@" + scale + "x.png"; | |
} | |
return { | |
"size" : width + "x" + width, | |
"idiom" : "iphone", | |
"filename" : filename, // The filename will be prefixed with the provided iOS filename prefix | |
"scale" : scale + "x" | |
} | |
} | |
var config = { | |
iOS: { | |
"images": [ | |
make(20, 1), | |
make(20, 2), | |
make(20, 3), | |
make(29, 1), | |
make(29, 2), | |
make(29, 3), | |
make(40, 1), | |
make(40, 2), | |
make(40, 3), | |
make(60, 2), | |
make(60, 3), | |
make(60, 2), | |
make(60, 3), | |
make(76, 1), | |
make(76, 2), | |
make(83.5, 2), | |
make(1024, 1), | |
] | |
} | |
}; | |
// Don't forget to export the config object! | |
exports = module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment