Re: EXIF support in PNG

John Bowler <[email protected]>
Newsgroups gmane.comp.graphics.png.general
Message-ID <CAP7U398SKN3os1i+EHD6Zar1t=3chPUHyPkGDHS3rExcnaFWwQ@mail.gmail.com>
FWIW if you use libjpeg it has an API 'jpeg_save_markers' which allows
you to save named markers in a list in the decompress struct.  The
only issue here is if the data exceeds the marker length limit of
65533 bytes, as might happen for an ICC profile, then the data might
be split across multiple markers.

The way the ICC dealt with this was to have each APP2 marker start with:

   ICC_PROFILE\0\x\y

Where \x is the sequence number of this chunk, as a byte and \y is the
total number of chunks.  I'm not sure if the Exif spec allows for
this, TsuruZoh Tachibanaya's document does not document this but it
was written in 1999, before Exif 2.2 (it was based on 2.0).  If even
Exif 2.2 is limited to one APP1 marker then Glenn's 'uncompressed'
method works without a loop; zlib can accomodate 65535 bytes in one
uncompressed chunk.

The jpeg_save_markers call was in version 6b of the library and was
probably in earlier versions.  It is in the version installed on
Ubunty Trusty.

John Bowler

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.