I've been trying to understand how XMP metadata worked on PNG files for the last few hours but couldn't quite wrap my head around it.
If I create a PNG image with Photoshop, save it and open the File Info dialog (File > File Info or Ctrl+Alt+Shift+I), I can see some XMP properties like CreateDate
, CreatorTool
or ModifyDate
.
Now if I try to open the file with exiv2 and read the metadata it seems to not find anything:
auto image = Exiv2::ImageFactory::open(imagePath);
image->readMetadata();
Exiv2::XmpData &xmpData = image->xmpData();
The same goes with the exiftool -xmp:all myImage.png
, exiv2 -P X myImage.png
, or even GIMP (but I think it is using exiv2 internally).
This wouldn't be such an issue if any added metadata were not removed when saving again with Photoshop. In case this wasn't clear, opening the image and adding XMP metadata with exiv2, saving it, opening the image back in Photoshop and in the file info dialog, the properties added previously are not there any more.
The weird thing is that if you do this entire process with a JPEG image, everything works as expected: all the properties are visible from both Photoshop and exiv2 and if I try to add metadata with exiv2 (using the same code), it appears in Photoshop as well.
Am I missing something obvious? Is there anything special about PNGs that is not true for JPEGs? I haven't tried to use Adobe's SDK to edit the XMP data, is it any better?
Any help would be much appreciated as this is starting to drive me crazy :/
Edit: After reading this post I tried with Adobe Bridge and it doesn't seem to display the same properties as Photoshop. If I add XMP metadata with Exiv2 they are displayed in Bridge but if I modify the image in Photoshop, the metadata is gone from Bridge again.
Textual information chunks - the metadata in PNG The iTXt, tEXt, and zTXt chunks (text chunks) are used for conveying textual information associated with the image. They are the places we can find all metadata of PNG file.
The PNG standard does not contain Exif data. Please see this: stackoverflow.com/questions/9542359/…
A PNG file contains a single image in an extensible structure of chunks, encoding the basic pixels and other information such as textual comments and integrity checks documented in RFC 2083. PNG files use the file extension PNG or png and have been assigned the MIME media type image/png .
Right, I finally got my hands on a copy of Photoshop CC and everything works fine. It must have been a bug in CS5 and CS6 that has been corrected in CC.
I think a recent update of Photoshop CS6 (13.1?) fixed this issue. It seems to have fixed problems with ICC color profiles in PNG images as well: http://forums.adobe.com/thread/1183489
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With