shssoichiro / oxipng

Multithreaded PNG optimizer written in Rust
MIT License
2.84k stars 122 forks source link

Not directly related to oxipng, but do you or anyone else know of something that works similarly for .ico files? #440

Open Jieiku opened 2 years ago

Jieiku commented 2 years ago

I absolutely love oxipng, it is my new favorite PNG optimizer.

I have been using it like this (Is it possible to get more compression? did I miss any of the advanced options?):

oxipng -o max --strip all -a -Z *.png

I am wondering if there is a tool that does something similar for .ico files? (I still have one of these for old browser compatibility)

TPS commented 2 years ago

FileOptimizer has a toolchain for .ico.

Jieiku commented 2 years ago

Seems to be windows software (unless i am wrong?) If anyone know of something that runs on Linux let me know, preferably with the command line but does not have to be.

I can try running this under wine if I get some time to mess around with that.

Just found this: https://jaydenseric.com/blog/favicon-optimization

can probably take the png files from oxipng and merge them into an ico file with imagemagik's convert command

convert 16.png 32.png 48.png favicon.ico

(going to give it a try now)

NOPE it takes my 3 ~130 byte png files and turns them into a 14.7kb huge ico file. Gimp did a better job than this (627kb)

TPS commented 2 years ago

According to FO's current code, it runs (directly on .ico) in this order

Probably tweak those parameters some, as FO changes them based on GUI options. Both tools support Linux.

Jieiku commented 2 years ago

ahhh good eye, I gave that a go, but does not work:

2022-05-29_12-37-00

It might be the format of the ico that causes it, will see if I can figure it out:

https://github.com/JayXon/Leanify#icon-file-ico

TPS commented 2 years ago

leanify v0.4.3 is ancient. Have you tried building from current source? Did you try running imagemagick w/ those parameters 1st? I don't hear much from anyone re: optimizing .ico & I've had mixed results myself.

Jieiku commented 2 years ago

I did look, it seemed to be the latest: https://github.com/JayXon/Leanify/releases (unless I am looking in the wrong places.)

it seems ico support is just not as good as png support: 2022-05-30_05-33-53

TPS commented 2 years ago

He hasn't released binaries in a very long time. You have to build from source to get 7 years of improvements. Last commit 4 months ago even improved Linux compilation.

Jieiku commented 2 years ago

Had something come up with a short deadline, going to take another look at this tomorrow. (or possibly this evening)

Jieiku commented 2 years ago

Gave this a try this evening, but was unable to build, I opened a ticket there though: https://github.com/JayXon/Leanify/issues/84

Jieiku commented 2 years ago

Yes, my icon was already compressed by GIMP, Leanify took it farther:

./leanify -i 9999 favicon.ico
Processing: favicon.ico
2.59 KB -> 1.90 KB      Leanified: 703 B (26.53%)

The favicon.ico went from 2650 bytes to 1947 bytes.

Thank you very much for recommending, and for prodding me again to try it!

WoW, it even further reduced the size of the png files that I had already processed with oxipng.

TPS commented 2 years ago

No 1 tool is perfect, or even close to it by itself, but using many can approach state-of-the-art. Try FileOptimizer any way you can — it's the best I've found in the last decade or so.

javiergutierrezchamorro commented 2 years ago

FileOptimizer has a toolchain for .ico.

Thank you for suggesting

TPS commented 2 years ago

Thank you for suggesting

@javiergutierrezchamorro Thank you for improving FO all these years. 🙇🏾‍♂️

Zerowalker commented 2 months ago

Would be nice if Oxipng added support for .ico, though I get that it's niche. But isn't ICO essentially the same as a png file, just a different structure to support multiple files in one?

TPS commented 2 months ago

But isn't ICO essentially the same as a png file, just a different structure to support multiple files in one?

Umm, no. .ico can contain .png, but is otherwise entirely a different format.

TPS commented 2 months ago

Would be nice if Oxipng added support for .ico, though I get that it's niche.

You're essentially looking for leanify, which is designed to also work on archive formats, which .ico practically is.

FileOptimizer might be even better.

andrews05 commented 2 months ago

Maybe you could suggest leanify adopt oxipng 😄 FileOptimizer does include it now.

Zerowalker commented 2 months ago

But isn't ICO essentially the same as a png file, just a different structure to support multiple files in one?

Umm, no. .ico can contain .png, but is otherwise entirely a different format.

That's basically what I meant, but thought it was only png files, so my bad:)