Scaling with Photoshop produces better results
Photoshop has the scaling option "Bicubic Sharper (reduction)", which produces less blurry, more legible images, compared to PNG to ICO. It's more noticable the smaller the image, and on 16x16, it can make a huge difference.
Here are two comparisons
Comparison screenshots
Open in different tabs or something to compare.
PNG to ICO:
Bicubic Sharper:
PNG to ICO:
Bicubic Sharper:
In the Java image, at 256x256, it's actually much sharper than the original image. So, I guess it comes at the cost of authenticity, and it might get oversharpened in some cases. But at lower resolutions, the sharpening is needed. Icons should be legible. There have been cases where I've manually sharpened a photo to a sweet spot in Photoshop, saved it at 256x256, looked fine, then converted with PNG to ICO, and it became way too blurry at lower resolutions.
Image Magick does not have Bicubic Sharper. I tried Lanczos and Box, hardly any difference. But a developer named Jason Summers has managed to imitate Bicubic Sharper rather faithfully with Image Magick. See Notes on Photoshop’s image resize algorithms.
I removed the crop parts of the command (because I did not have time to figure that out), and changed convert to magick (IM says convert is depricated), and the result is barely indistinguishable from Photoshop!
Screenshot
Bicubic Sharper imitation
I don't know why that last picture is 256x255. The command prompt says I entered 256x256.
A compromise could be to sharpen at resolutions 128x128 (or 96x96) and below, but use normal resizing on the higher resolutions. I have done it like that one or two times when scaling manually with Photoshop, when I wanted authenticity.
Here are the original pictures:
Download URL
https://drive.google.com/file/d/1PyA9RvyP6e6pK-LkbkVkEIVDW8omRQQX/view
(The Java image is public domain, the woman is free to use under the Unsplash license, published by the user see plus.)
Very interesting study ! Thanks for your time. Do you have a sample code to provide ?
I am working on this.
But yeah, if you skip the box filter, like I did in my example, then just convert each size manually, with
these parameters before -resize:
-filter cubic -define filter:b=0 -define filter:c=2.2 -define filter:blur=1.05
Then move all sized images into their own folder, and combine them with magick * output.ico.
I am working on implementing it more properly.
It would be better this functionality done automatically with the -auto-resize parameter in ImageMagick though. That doesn't feel too unreasonable to me. I guess I will make an issue at https://github.com/ImageMagick/ImageMagick, at some point.
Is latest published version better in your opinion ? (v1.2).
I added Lanczos scaling filter.
Cheers