ICC Profiles not copied to PNGs

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
fnordware
Posts: 4
Joined: 2014-04-07T10:41:17-07:00
Authentication code: 6789

ICC Profiles not copied to PNGs

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ICC Profiles not copied to PNGs

Post 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.
fnordware
Posts: 4
Joined: 2014-04-07T10:41:17-07:00
Authentication code: 6789

Re: ICC Profiles not copied to PNGs

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ICC Profiles not copied to PNGs

Post by fmw42 »

That would be a question for the IM PNG developer, glennrp.
fnordware
Posts: 4
Joined: 2014-04-07T10:41:17-07:00
Authentication code: 6789

Re: ICC Profiles not copied to PNGs

Post 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.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: ICC Profiles not copied to PNGs

Post 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?
fnordware
Posts: 4
Joined: 2014-04-07T10:41:17-07:00
Authentication code: 6789

Re: ICC Profiles not copied to PNGs

Post 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.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: ICC Profiles not copied to PNGs

Post 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).
Post Reply