Re: EXIF support in PNG

John Bowler <[email protected]>
Newsgroups gmane.comp.graphics.png.general
Message-ID <CAP7U39_goxDCO3kMTBo+5=f78DSbfb+7aUKzH0z+ndfg2VkQGQ@mail.gmail.com>
This github project:

https://github.com/jbowler/jpegtopng

Now contains a Makefile and source to build three programs:

jpegtopng: requires an installed -ljpeg and -lz
jpegdump: stand-alone hack program to dump a JPEG
pngdumpmeta: requires -lpng and -lexiv2
The first file takes any JPEG with an APP1 EXIF marker and converts it
to an exIf chunk matching Willems previously supplied example image.

The second is just a way of looking inside a JPEG, at least for the
markers it understands (it also produces lots of warnings with -Wall).

The third is the real example program; it decodes the exIf chunk
(that's just a few lines of code, mostly recognizing that it is an
exIf from the header) then it prints the contents using the Exiv2
library; that's about 20 lines of code as well.

It also prints an ISO XMP chunk.  Quite a lot of the code is to verify
UTF-8 data (that's in the directory hutf8/), XMP is just raw XML so it
just prints so long as it is valid.

It will also print text chunks; either a list of the keywords or the
text one of them contains.  It prints the text in UTF-8; so it
converts the Latin1 text in tEXt or zTXt chunks into UTF-8 on-the-fly.

It only does one thing at once.  The first and last programs read from
stdin and write to stdout (no file management).

Next I'm going to look at adding support for the text chunk used to
output Exif from Image/GraphicsMagick and DigiKam.  The sample code in
the pngexif directory already does that but I haven't tested it.  It's
132 lines of code as opposed to 59 when the data is in an unknown
chunk; decoding the format about doubles the amount of code required
(the rest of it is comments and looking though the text or unknown
chunk lists.)

I haven't verified compilation against libpng12 yet, but I don't
anticipate any problems.

John Bowler

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
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.