Skip to content

Instantly share code, notes, and snippets.

@soharu
Forked from alldne/config.js
Created August 21, 2018 07:05
Show Gist options
  • Save soharu/34b79c55e557935dffb74226d274b3b6 to your computer and use it in GitHub Desktop.
Save soharu/34b79c55e557935dffb74226d274b3b6 to your computer and use it in GitHub Desktop.
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