Is XMP metadata supported in PNG images?

情到浓时终转凉″ 提交于 2019-12-10 14:17:13

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/21316655/is-xmp-metadata-supported-in-png-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!