Skip to content

Instantly share code, notes, and snippets.

@alldne
Last active Aug 21, 2018
Embed
What would you like to do?
Resizing icon (iOS)
// 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