Page 1 of 1

ICC Profiles not copied to PNGs

Posted: 2014-04-07T10:55:38-07:00
by fnordware
If I have a TIFF or PSD with an ICC profile embedded and `convert` the file to a PNG, the ICC profile doesn't come with it. In fact, it looks like the sRGB chunk is getting set when it shouldn't (my source file has the Adobe RGB profile).


A harder problem is hoping to get other metadata into the PNG. The TIFF has IPTC metadata, which is not supported by PNG. Ditto with EXIF. It is theoretically possible to convert IPTC or EXIF into XMP, which can be embedded in a PNG tEXt chunk, but I assume ImageMagick doesn't have any code to do that at present.


Version: ImageMagick 6.7.9-6 2012-09-15
Platform: OS X 10.6.8
cmd: convert P1000423.tif P1000423.png

Re: ICC Profiles not copied to PNGs

Posted: 2014-04-07T11:56:06-07:00
by fmw42
You need to upgrade to a current version of IM. Your version is almost 100 versions old.

I saved a picture in PS with Adobe icc profile as both tif and psd. Then converted each to PNG. The PNG file in both case contained lots of meta data and the Adobe profile.

I am using IM 6.8.8.10 Q16 Mac OSX Snow Leopard.

Re: ICC Profiles not copied to PNGs

Posted: 2014-04-08T08:43:47-07:00
by fnordware
Yep, you're right. I updated and now the ICC profile comes through.Thanks!

I see a bunch of other metadata as well, all broken up into many separate tEXt chunks. And then there's some sort of zTXt "Raw profile type xmp" . What ImageMagick doesn't do is embed all the XMP in one iTXt called "XML:com.adobe.xmp" as it says to do in this document.

Re: ICC Profiles not copied to PNGs

Posted: 2014-04-08T09:28:02-07:00
by fmw42
That would be a question for the IM PNG developer, glennrp.

Re: ICC Profiles not copied to PNGs

Posted: 2014-04-08T10:08:53-07:00
by fnordware
One more thing: I'm not sure what to do with that raw XMP zTXt chunk. XMP should be human-readable, but that chunk in the files I'm getting from ImageMagick is noise. I'm pretty sure I'm looking at decompressed data.

But like I said, if XMP is to be included (and I'd like it to be), Adobe has the spec for doing so.

Re: ICC Profiles not copied to PNGs

Posted: 2014-04-08T14:09:24-07:00
by glennrp
fnordware wrote:One more thing: I'm not sure what to do with that raw XMP zTXt chunk. XMP should be human-readable, but that chunk in the files I'm getting from ImageMagick is noise.
The zTXt chunk contains compressed text. Did you decompress it before looking at it?

Re: ICC Profiles not copied to PNGs

Posted: 2014-04-08T14:30:21-07:00
by fnordware
glennrp wrote:
fnordware wrote:One more thing: I'm not sure what to do with that raw XMP zTXt chunk. XMP should be human-readable, but that chunk in the files I'm getting from ImageMagick is noise.
The zTXt chunk contains compressed text. Did you decompress it before looking at it?

Doesn't libpng do it for me? It doesn't look like zlib compression. In text form it looks like:

Code: Select all

.xmp.  21528.3c3f787061636b657420626567696e3d22efbbbf22206964...
The zlib uncompress() function doesn't like it and TweakPNG shows the same.

Re: ICC Profiles not copied to PNGs

Posted: 2014-04-08T15:05:54-07:00
by glennrp
[quote="fnordware"]
Doesn't libpng do it for me? It doesn't look like zlib compression. In text form it looks like:

Code: Select all

.xmp.  21528.3c3f787061636b657420626567696e3d22efbbbf22206964...
I guess it's HEX-encoded. I know the ICC profiles are. Not sure why ImageMagick isn't
reversing that on decode. I'll have a look. (If you are extracting the zTXt chunk with some
other application, then it'll still be HEX-encoded).