to-ico
to-ico copied to clipboard
Chokes on 512x512px image
If it can't downscale, it should fail with a user friendly exception ("Images larger than 256x256 px are not supported").
$ file icon_512x512.png
icon_512x512.png: PNG image data, 512 x 512, 8-bit/color RGBA, non-interlaced
$ node_modules/.bin/to-ico icon_512x512.png
TypeError: "value" argument is out of bounds
at checkInt (buffer.js:1040:11)
at Buffer.writeUInt8 (buffer.js:1088:5)
at createDirectory (node_modules/to-ico/index.js:32:6)
at Promise.all.then.data (node_modules/to-ico/index.js:98:16)
at process._tickCallback (internal/process/next_tick.js:103:7)
$ npm list | grep to-ico
└─┬ [email protected]
└─┬ [email protected]
Instead of throwing, we could just resize it to 256x256, regardless if resize is true or not. I'm also thinking about setting resize to true by default since it's really fast anyway and you'd want it in most cases.
@kevva if you can tell me which way you'd like it I'd love to send a PR 🙌
maybe @sindresorhus has the magic answer 🦄 😏
@albinekb, I think the first step is to just resize the image to 256x256 if it's larger. A PR would be greatly appreciated :+1:.
Right.
Also related: https://github.com/kevva/to-ico/issues/20
Generally setting the option {resize: true} should prevent that.