I'm told that some tools carefully optimize PNG data (optipng, advpng). At the moment, this library always decodes and re-encodes PNGs before inserting the data into the icns file, which loses those optimizations.
but it's not product-quality, for several reasons:
It unwrap()s in bad places, because we're no longer encoding and decoding PNGs in locations where we could return an error. In general therefore the API needs some work.
I haven't yet attempted to respect the pngio optionality though this should be straightforward.
The golden.rs tests are now a bit hideous. The PNG data within the tests/icns file did not match the PNG data within the tests/png directory. The tests only passed because they were relying on the old behavior of decoding and re-encoding PNGs so that they subsequently matched. Therefore some gross hackery has been done to force a decode and re-encode.
I'm unlikely to get around to tidying this up enough to upstream, but I thought I'd post this here in case anyone else encounters the same issue and wants to try.
I'm told that some tools carefully optimize PNG data (
optipng
,advpng
). At the moment, this library always decodes and re-encodes PNGs before inserting the data into the icns file, which loses those optimizations.I had a go at this here: https://github.com/mdsteele/rust-icns/compare/master...adetaylor:png-passthrough-unchanged
but it's not product-quality, for several reasons:
unwrap()
s in bad places, because we're no longer encoding and decoding PNGs in locations where we could return an error. In general therefore the API needs some work.golden.rs
tests are now a bit hideous. The PNG data within thetests/icns
file did not match the PNG data within thetests/png
directory. The tests only passed because they were relying on the old behavior of decoding and re-encoding PNGs so that they subsequently matched. Therefore some gross hackery has been done to force a decode and re-encode.I'm unlikely to get around to tidying this up enough to upstream, but I thought I'd post this here in case anyone else encounters the same issue and wants to try.