Skip to content

Instantly share code, notes, and snippets.

@alldne
Last active August 21, 2018 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alldne/4a2e187320c792531a86cbf7b3b4d16c to your computer and use it in GitHub Desktop.
Save alldne/4a2e187320c792531a86cbf7b3b4d16c 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