mdsteele / rust-icns

Rust library for encoding/decoding Apple Icon Image (.icns) files
MIT License
24 stars 10 forks source link

icns compression #8

Open relikd opened 1 year ago

relikd commented 1 year ago

Hey there,

I am the developer of icnsutil and just wanted to reach out and offer some help if needed. I have no experience with Rust but I analyzed the icns format thoroughly during my development of the Python lib. In fact, I extended the Wiki article quite a bit during that time (Jul – Oct 2021).

As for testing JPEG2000 support, the old Caffeine App used JPEG2000. Or you can use my lib to compose a new app icon.

I just saw @kornelski as contributor and was wondering whether we could add support for icns compression in ImageOptim (as this was my main purpose with icnsutil anyway). We would "only" need to read the unmodified PNG data, compress it, write the data back at the same spot, and update all icns type-header offsets. In any case, PNG is the only compressable format here. But the process itself is rather simple.

mdsteele commented 1 year ago

Better compression support and JPEG2000 support would both be great to have. I haven't really been actively working on this library myself lately, but very happy to review PRs if you want to try to land either or both of these features!

kornelski commented 1 year ago

In general yes, I'd like to have ICNS compression and optimization tool, either in ImageOptim, or as a standalone tool.

However, currently I'm screwed by Apple's Code Signing, and I can't make any new releases of ImageOptim.

relikd commented 1 year ago

@JoshuaBrest isnt that just the normal ICNS PackBits compression? If so, that wouldnt help much for ImageOptim. All the formats using the PackBits algorithm cannot be compressed further – they are at maximum compression by definition. No, I was talking about PNG (and maybe JPEG2000) compression only. All the other formats (including ARGB) require a specific format and cannot be optimized. So for ImageOptim we would need to extract all PNGs, compress them with the ImageOptim-PNG-suite, and then write them back to the icns file (adjusting the sizes and offsets).