victorvde / jpeg2png

silky smooth JPEG decoding
GNU General Public License v3.0
469 stars 26 forks source link

Wish: copy exif data into destination PNG #5

Open fidergo-stephane-gourichon opened 5 years ago

fidergo-stephane-gourichon commented 5 years ago

It sometimes makes sense to process JPEG files that have exif data in them. Currently, jpeg2png produces a PNG without the EXIF data. Writing a PNG with the original EXIF data would make sense. The program doesn't even have to parse it, just copy.

There are some precedents of straight code adoption for this. For example, how RawTherapee copied it from darktable: Add support for metadata in PNG · Issue #3352 · Beep6581/RawTherapee

Darktable code https://github.com/darktable-org/darktable/blob/master/src/imageio/format/png.c#L60 and how they tell it:

/* Write EXIF data to PNG file.
 * Code copied from DigiKam's libs/dimg/loaders/pngloader.cpp.
 * The EXIF embedding is defined by ImageMagicK.
 * It is documented in the ExifTool page:
 * http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html
 *
 * ..and in turn copied from ufraw.
fidergo-stephane-gourichon commented 5 years ago

There is now an official specification for EXIF support in PNG: http://libpng.download/documents/pngext-1.5.0.html#History 3.7. eXIf Exchangeable Image File (Exif) Profile