Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass through PNG data unchanged #3

Open
adetaylor opened this issue Mar 13, 2020 · 0 comments
Open

Pass through PNG data unchanged #3

adetaylor opened this issue Mar 13, 2020 · 0 comments

Comments

@adetaylor
Copy link

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: master...adetaylor:png-passthrough-unchanged

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant