Menu ▾ ▴

#14 added PNG Interlacing and compression support

closed
None
5
2012-10-31
2008-04-09
Lucian Sabo
No

The PNG is missing interlacing support and compression flags.

Interlacing is fully supported by libPNG with the Adam7 algorithm.

So add these flags to FreeImage.h

/*PNG Save Flags */

define PNG_INTERLACED 0x2000 // Adam7 interlacing

define PNG_Z_NO_COMPRESSION 0x0100

define PNG_Z_BEST_SPEED 0x0200

define PNG_Z_BEST_COMPRESSION 0x0400

define PNG_Z_DEFAULT_COMPRESSION 0x0800

You can use these compression presets or just put a number between 1 or 9 to set the compression for ZLIB.

I've modified pngplugin.cpp also to improve compression for high color images (>16bit) by using filters and Z_FILTERED strategy, like libPNG documentation recommends. The results prove that using this optimization the compression ratio is better.

Hervé, I hope you will include this patch in the FreeImage distribution...

I have attached the modified Save function from plugin.cpp:

Discussion

  • Lucian Sabo

    Lucian Sabo - 2008-04-09
     
  • Hervé Drolon

    Hervé Drolon - 2008-05-19

    Logged In: YES
    user_id=613758
    Originator: NO

    Thanks for the patch,
    it is now merged with the CVS.

    Best regards,
    Hervé Drolon

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Anonymous
Anonymous

Add attachments
Cancel