rust-icns icon indicating copy to clipboard operation
rust-icns copied to clipboard

icns compression

Open relikd opened this issue 2 years ago • 3 comments

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.

relikd avatar Jun 12 '23 22:06 relikd

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!

mdsteele avatar Jun 14 '23 00:06 mdsteele

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.

kornelski avatar Jun 14 '23 01:06 kornelski

@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).

relikd avatar Jul 06 '23 14:07 relikd