Does PNG contain EXIF data like JPG?
Asked Answered
A

6

131

I was wondering if PNG contains data like the following?

What I did was to convert the jpg file to png format, and I was expecting to retrieve the same info I had on the jpg as below:

Currently using this as3 library to read the data.

  • IDF0--- IDF @[134 - 248] (9 entries)
    • Orientation (SHORT) : 1
    • XResolution (RATIONAL) : 72/1
    • YResolution (RATIONAL) : 72/1
    • ResolutionUnit (SHORT) : 2
    • Software (ASCIIx16) : QuickTime 7.6.6
    • DateTime (ASCIIx20) : 2011:10:02 22:43:37
    • HostComputer (ASCIIx16) : Mac OS X 10.6.8
    • Exif IFD (LONG) : 8 34853
    • GPS IFD (LONG) : 248

 

  • EXIF IDF--- IDF @[8 - 134](10 entries)
    • ExifVersion (UNDEFINEDx4) : 0220
    • DateTimeOrigina (ASCIIx20) : 2011:04:14 17:22:01
    • UserComment (UNDEFINEDx63) : ASCII
    • FlashpixVersion (UNDEFINEDx4) : 0100
    • ColorSpace (SHORT) : 1
    • PixelXDimension (LONG) : 1022
    • PixelYDimension (LONG) : 486
    • Unknown (ASCIIx13) : Image Tag-LOL
    • SceneCaptureType (SHORT) : 0

 

  • GPS IDF--- IDF @[248 - 338](7 entries)
    • Interoperability Index (ASCIIx2) : N
    • Interoperability Version (RATIONALx3) @425: 52/1, 1144/100, 0/1
    • Unknown (ASCIIx2) : W
    • Unknown (RATIONALx3) : 1/1, 4392/100, 0/1
    • Unknown (RATIONAL) : 5/1
    • Unknown (ASCIIx2) : T
    • Unknown (RATIONAL) : 3694/117

 

Aphasic answered 3/3, 2012 at 0:49 Comment(0)
O
156

Edit: Version 1.5.0 (July 2017) of the Extensions to the PNG 1.2 Specification has finally added an EXIF chunk. It remains to be seen if encoders-decoders begin to support it.

Original: PNG does not embed EXIF info. It allows, however, to embed metadata "chunks" inside the image. Some of the standardized chunks correspond to a few EXIF attributes (physical dimensions, timestamp). And it's also possible to store arbitrary textual data as key=>value pairs, or to define new chunk types. So, you could in theory store any EXIF information... but, alas, in your own custom format. Some attempts to standarize have not caught up, it seems.

Oneill answered 6/3, 2012 at 1:38 Comment(0)
I
35

Edit: As of July 2017, PNG officially supports an eXIf chunk to store EXIF metadata (specification). ExifTool 10.59 and later write EXIF to this new chunk in PNG images.

Original: ImageMagick stores EXIF information in a PNG "Raw profile type APP1" zTXt chunk when converting from JPEG images. This method of storing EXIF in PNG images is also supported by ExifTool (and I believe Exiv2 too), but it is not part of the PNG or EXIF specification.

Invocate answered 23/7, 2014 at 16:54 Comment(2)
That's very good to know! Do you know if it extracts it from TIFF as well?Moriarty
The PNG group has recently been considering adding a new "eXIf" and/or "zXIf" chunk to store EXIF information. ExifTool 10.43 added support for "exIf" and "zxIf" chunks in support of this.Invocate
M
9

PNG does not support embedding of EXIF information. When you convert from JPEG to PNG the information is lost.

Maymaya answered 3/3, 2012 at 1:9 Comment(6)
This is not entirely true. For example, if you use convert (from ImageMagick) to convert a JPEG to a PNG and then use convert to convert the PNG back to a JPEG the new JPEG will still have the EXIF Data in it.Phonograph
GIMP does store "User Comment" in a PNG as "EXIF2" metadata. It seems that there is a field for this in the chunks. The exact hows and whys I am uncertain of. I have a similar requirement myself.Diverge
In 2012, this answer might have been true, but is it still accurate?Curet
Wrong, both back then and now. PNG does have metadata - it just doesn't use the EXIF standard for it. So good conversion programs would convert the EXIF metadata to PNG metadata where applicable. (Nowadays PNG has an eXIf chunk, but I'm not sure why it was added. Presumably it's designed for carrying forward the original EXIF when converting from JPEG or TIFF.)Thiouracil
PNGs have stored XMP in a iTXt chunk or two for many years. Much of EXIF can be mapped to XMP (and back), before you even consider the new eXIf chunk.Clarissa
I just converted a jpg with EXIF data to png and then back with convert (imagemagick-6.q16 6.9.10.23) and it did not preserve the EXIF data.Anaesthesiology
G
9

As of July 2017, there does appear to be officially registered chunk for EXIF data called... eXIf:

The data segment of the eXIf chunk contains an Exif profile in the format specified in "4.7.2 Interoperability Structure of APP1 in Compressed Data" of [CIPA DC-008-2016] except that the JPEG APP1 marker, length, and the "Exif ID code" described in 4.7.2(C), i.e., "Exif", NULL, and padding byte, are not included.

Note that this is both A) only a few months old (as of writing) and B) an optional extension, not part of the basic specification. Therefore, support for the eXIf chunk might be limited in many applications.

Gamesmanship answered 5/10, 2017 at 22:24 Comment(0)
C
5

Yes and no.

As other answers have already stated, PNG didn't have a formal EXIF chunk until eXIf was added in v1.5.0 (2017), and to my knowledge this chunk still does not enjoy wide support.

But that's because it doesn't need it. Many pieces of software encode EXIF in a PNG by convention in an iTXt (or compressed zTXt) chunk notated "Raw profile type APP1". The newer eXIf chunk was intended to provide a standardised location for this, though in my opinion that ship has sailed now.

In addition, much of the EXIF standard's metadata can be represented by XMP, an alternative and newer metadata transport mechanism that has an EXIF namespace for precisely this purpose. PNG files have included XMP documents (including translated EXIF metadata) in iTXt chunks for years. You will find that many processors convert between the two on the fly.

Clarissa answered 4/6, 2020 at 19:54 Comment(4)
Do these same processors, whatever they are, convert XMP or EXIF to/from the various standard PNG metadata chunks?Thiouracil
@Thiouracil The standard PNG metadata chunks are limited and could not represent the breadth of EXIF or XMP data. That's why we've historically encoded EXIF/XMP into the files (in text chunks).Clarissa
OK, I'll rephrase that: Do these same processors convert those items of XMP or EXIF metadata that are capable of being represented by standard PNG metadata chunks to standard PNG metadata chunks, and vice versa?Thiouracil
@Thiouracil I don't know. I doubt it. If they do, it'd be very limited. Overall there's really no benefit in doing so; the EXIF and XMP fields may not be standard, but they're completely conventional and widely used. So everybody just uses that. The PNG metadata does include some Keywords/Author stuff but it's mostly image data.Clarissa
T
2

Did you mean:

  1. Do PNG files contain the metadata items you listed? Short answer: It varies.
  2. Does PNG use the EXIF standard for storing such metadata? Short answer: Generally no.

Generally, PNG uses various chunks that are part of the PNG standard for storing metadata. To go through your list:

  • Orientation - Not applicable to PNG - fixed as row by row starting from the top left.
  • XResolution, YResolution, ResolutionUnit - pHYs chunk.
  • Software, HostComputer, other textual metadata - tEXt, iTXt, zTXt chunks.
  • DateTime - Not clear to me what this is the date/time of. tIME indicates the date/time of last modification to the image data; other dates/times can be stored in text chunks. Creation Time is actually a defined text chunk key, but the format and how time zones are handled aren't stipulated, which is a bad design.
  • ColorSpace, PixelXDimension, PixelYDimension - not sure how these would be metadata. They are fundamental to the image, and as such are in the IHDR chunk.
  • Not sure what the others you've listed mean.

But puzzlingly, in recent years an eXIf chunk has been added to the official list of extension chunks (which is essentially an addendum to the PNG spec). Presumably it's targeted at preserving the information in files converted from JPEG/TIFF to PNG and not intended to be used in files that are created as PNGs originally, but that isn't clear.

Thiouracil answered 21/2, 2020 at 13:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.