PNG eXIF chunk proposal

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

PNG eXIF chunk proposal

Post by glennrp »

During January and February 2017 the PNG Development Group discussed
a proposed eXIf chunk for storing the Exif profile. See
http://www.simplesystems.org/png-group/proposals/eXIf/

The PNG group discussion has lapsed without action on the proposal. The proposal
was pretty simplistic: just copy whatever is in a JPEG APP1 chunk, minus
a few overhead bytes, into the eXIf chunk.

I implemented the proposal in ImageMagick/coders/png.c
(currently #ifdef'ed out, but can be enabled with -DexIf_SUPPORTED)
to simply copy ImageMagick's Exif property, minus the first few bytes,
into an eXIf chunk.

One troublesome aspect was that the ImageMagick "Exif" property can contain
the JPEG thumbnail image, which isn't strictly a part of Exif.

I'm thinking of updating the proposal to declare that the thumbnail should not be
included in the exIf chunk data, and rewriting the ImageMagick chunk support to
eliminate or ignore it.

People wanting to preserve the thumbnail should use a different
private chunk for that.

Thoughts?
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: PNG eXIF chunk proposal

Post by Jason S »

One troublesome aspect was that the ImageMagick "Exif" property can contain
the JPEG thumbnail image, which isn't strictly a part of Exif.
I'm confused. A JPEG thumbnail image is definitely a standard part of Exif. Is there something special about the 'ImageMagick "Exif" property'?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG eXIF chunk proposal

Post by glennrp »

The troublesome part is maintaining the thumbnail when the image is edited. We dealt with that in the chunk proposal by mentioning that the thumbnail might be out of sync with the main image. Specifically, the current draft says "While encoders may choose to update them, there is no expectation that any thumbnails present in the Exif profile have (or have not) been updated if the main image was changed. "

It is also troublesome because PNG is supposed to be a single-image format, and purists think that a thumbnail embedded in a PNG would violate that philosophy. Back in 1995 when we were designing the PNG format, we considered and rejected the idea of having a thumbnail chunk.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: PNG eXIF chunk proposal

Post by Bonzo »

I know what you mean about the jpg thumbnail being out of sink. Out of interest how would a create private chunk in imagemagick?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PNG eXIF chunk proposal

Post by snibgo »

Any thumbnail will often be out of sync with the main image. For example, a raw file from a camera may contain both a sensor-raw Bayer image, and a camera-processed jpeg. The raw file may be processed to make a tiff, png or jpeg which also contains the in-camera jpeg.

This is a potential source of confusion, but I'm in favour of preserving thumbnails unless deletion is explicitly requested. Yes, it will often be historical, rather than representing a current thumbnail of the main image.

Reconstructing a current thumbnail is easy, if the user wants this. But once a historic thumbnail is removed, it is gone forever.
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG eXIF chunk proposal

Post by glennrp »

Bonzo wrote: 2017-05-29T12:06:45-07:00 I know what you mean about the jpg thumbnail being out of sink. Out of interest how would a create private chunk in imagemagick?
Look at the "caNv" chunk support in coders/png.c; this is a fairly simple example of using a user read function to understand a private
chunk. There's also code in coders/png.c to write the caNv chunk and several other private chunks.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: PNG eXIF chunk proposal

Post by Bonzo »

Thank you for the info glennrp but I am not a coder and do not even know how to install Imagemagick without the exe file so there is no way I can modify the png.c file.

I have no use for it but thought if it was straight forward I would take a look.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG eXIF chunk proposal

Post by glennrp »

Thanks for the feedback. We're proceeding with the eXIf chunk proposal, keeping the thumbnail if it's present.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG eXIF chunk proposal

Post by glennrp »

The eXIf chunk proposal is being voted upon now, in the png-mng-misc @ lists.sourceforge.net list.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG eXIF chunk proposal

Post by glennrp »

The eXIf chunk proposal was approved by the PNG Development Group.
I've checked eXIf chunk support into coders/png.c in IM6 and IM7.
Post Reply