We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3595

Summary: use libPNG in IMG_SavePNG_RW()
Product: SDL_image Reporter: Fabian Greffrath <fabian+debian>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.1   
Hardware: x86_64   
OS: Windows 7   

Description Fabian Greffrath 2017-03-01 13:55:56 UTC
Hi there,

I wonder why the IMG_SavePNG_RW() function currently uses the PNG saving routines provided in the several-hundred-kB "miniz.h" header file instead of relying on libpng. If you want to prevent libpng from becoming a hard dependency (but, why?) you could still fall back to the miniz solution if libpng is unavailable.

On the pro side, the libpng-based solution would be more flexible. For example, and most importantly in my case, libpng allows for saving of palettized images which vastly reduces the output file size.

Would you accept a patch to (a) either replace the current implementation with one solely based on libpng or (b) use a libpng-based implementation and only fall back to using miniz.h if libpng is found unavailable?

Cheers,

Fabian
Comment 1 Sam Lantinga 2017-09-12 07:18:02 UTC
This was implemented in bug 3392

*** This bug has been marked as a duplicate of bug 3392 ***