icc colorprofile in pdf's

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

icc colorprofile in pdf's

Post by adil@alfasoft.ro »

I want to assign an ICC output profile to an pdf. Usually, after that,this profile must be found in the new pdf created under the ICCBased clause .
After conversion the image is changed (clearly the output profile do something) but I do not found the informations about the profile in the new pdf.

The same command work very well on tiff's ,jpeg's.
Can anyone help me with that?
Thank you in advance, Adrian
indiego
Posts: 75
Joined: 2010-10-16T06:35:10-07:00
Authentication code: 8675308

Re: icc colorprofile in pdf's

Post by indiego »

I have tested a bit and it looks like IM is adding the ICC profile to the graphic stream and not into the PDF structure. So it does the same as it does with *.gif,*.jpg, etc.

I tried it both ways.
1. convert a jpg into pdf and add the profile to the pdf
2. convert a jpg with profile into a pdf (which gives much smaller results)

An export of the so constructed pdf to jpg results in a jpg with embedded profile.

I guess IM is not the right tool for modifying the profile in the PDF structure. You can do so with Acrobat, ConTeXt (http://wiki.contextgarden.net) and probably some more PDF tools I'm unaware of.
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

Re: icc colorprofile in pdf's

Post by adil@alfasoft.ro »

"IM is adding the ICC profile to the graphic stream" . IM rasterize the initial pdf and the image is embedded into an object of output pdf? Can you tell'me more about that? I believe the image is encoded in the output pdf (FlateDecode,or RunLengthDecode) . What kind of image type is after decode? Tiff,jpg...
Thank you!
indiego
Posts: 75
Joined: 2010-10-16T06:35:10-07:00
Authentication code: 8675308

Re: icc colorprofile in pdf's

Post by indiego »

Streams in PDF contain unchanged (aside compression) data. In this example the compressed (/Filter shows the used compression method), but unchanged input graphic. Think about it as a boxed graphic with a PDF frame around it. If you add an ICC profile to such a PDF, the graphic inside that stream is changed, not the PDF structure itself. By PDF structure I mean the different ways how PDF can deal with ICC profiles. You can add a private ICC profile to every single object in PDF, use the ICC profile as default color space or you can define the so called output intent with it. None of these is used by IM. What IM does is to add the profile directly to the (stream) graphic. When you convert such a PDF back to JPG you get a JPG with embedded ICC profile. You just remove the PDF frame around that graphic.

BTW: Is you question just academic or do you have a reason for this specific format?
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

Re: icc colorprofile in pdf's

Post by adil@alfasoft.ro »

No, I must use this format on a small app, and have a lot of problems with him (much more then jpg and tiff).
But, if I apply an output profile to an pdf and after that convert to tiff I do not found this profile inside tiff file.
If I apply same profile directly to tiff, the profile is inside the tiff (there is an specific tiff tag where I can find'it).
So, the problem is that if I apply to pdf an profile, I must know that, and until now I have not find a way where to check that. Even identify don't tell me that an profile was applied.
Thank you.
indiego
Posts: 75
Joined: 2010-10-16T06:35:10-07:00
Authentication code: 8675308

Re: icc colorprofile in pdf's

Post by indiego »

Adding a profile to a PDF doesn't work! Sorry for making a wrong statement here :(

After you have reported your problems with tiff, I have started to test again with a real big icc profile (4MB). Guess what, I get the same PDF size as with the small srgb.icc. Uncompressing the PDF with pdftk still left the graphic stream compressed and therefore it's impossible to locate the profile in there.

My suggestion is, that you add the profile to the JPG before you convert it into PDF. TIFF is not supported by PDF.
The good news is, that this seems to work (respecting to size). The bad news is, that the automatically created thumbnail image in the PDF seems to embed the profile too; over 8MB for my example. Not that handy. Donno if there is an option to suppress the thumbnail creation in IM.
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

Re: icc colorprofile in pdf's

Post by adil@alfasoft.ro »

Thank you.I have some questions regarding the way IM handle pdf's.
1)Converting an pdf(not made by IM) --> pdf with convert input.pdf output.pdf
IM rasterize pdf (like an image) and embed this image in an single obj in output pdf?

2) If yes, the image is embed all the time in a jpg format? Or in different format?

3)PDF. Because after applying an output ICC profile the colors are changed (clearly IM work and change colors) , the informations regarding this profile (name, rendering) are embeded in the jpg file ? (the file from second question).

4) PDF. identify cmd do not show ICC output profile . This is a bug? or is something normal. Is not the same situation with tiff's and jpeg's , where everithing work very good.

Thank you for your time.
indiego
Posts: 75
Joined: 2010-10-16T06:35:10-07:00
Authentication code: 8675308

Re: icc colorprofile in pdf's

Post by indiego »

1) AFAIK yes

2) Donno, but I guess there is normally no reason to change the format (as long as it's supported by PDF)

3) By simply adding a color profile you don't change a single color value. This only means that the colors in that graphic are from the specified gamut. If I add the color profile of my monitor, the raw RGB hex value #FF0000 becomes the red that I see on my calibrated monitor. Take the same raw red value and show it on a your monitor or print it and you probably get a different red. By adding the profile of my monitor to that graphic, this red value (and all the other colors) is specified. This is what color management is about.

I can't give you an answer for the second part. I have not the slightest knowledge about jpg internals :mrgreen:

4) Just tested that. Transforming back the PDF to the original graphic format strips of the profile here. The only 'proof' for the existence of the profile in the PDF is the size of the PDF :(

-----------
Just out of curiosity: what program forces you to use PDF?
Post Reply