FoxP / PNG-to-ICO

KISS batch script to easily convert PNG, GIF, BMP, SVG or JPG images to multi-resolution ICO files using ImageMagick.
https://foxp.github.io/PNG-to-ICO/
The Unlicense
171 stars 20 forks source link

Scaling with Photoshop produces better results #13

Open virginviolet opened 1 month ago

virginviolet commented 1 month ago

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: ![Java (PNG to ICO)](https://github.com/user-attachments/assets/ac9463d6-db36-40a2-8ed0-befbf48aba6d) ### Bicubic Sharper: ![Java (PBicubic Sharper)](https://github.com/user-attachments/assets/2b65aac6-dddb-4b00-9422-9ef3542337df) ### PNG to ICO: ![Woman (PNG to ICO)](https://github.com/user-attachments/assets/b6efd991-ea79-4bff-b6bd-25aa87b17485) ### Bicubic Sharper: ![Woman (Bicubic Sharper)](https://github.com/user-attachments/assets/063f319f-cc22-423f-939f-32777f149e68)

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 ![Java (Bicubic Sharper imitation)](https://github.com/user-attachments/assets/5940d647-4ade-46c9-807e-e0c75bd8edd3) 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.)

FoxP commented 1 month ago

Very interesting study ! Thanks for your time. Do you have a sample code to provide ?