Page 1 of 1
How to have CMYK PDF retain original colors
Posted: 2016-01-27T21:10:04-07:00
by patrick.h
Hi,
I've been having a bit of difficulty getting imagick to return a composited CMYK pdf with the same colors. Out of curiosity, I tried the simplest ImageMagick command that I know of: open convert and close, and the colors are still different.
Code: Select all
convert -density 300 before.pdf after.pdf
before and after pdfs are found here:
https://www.dropbox.com/sh/z6jg2e12zplc ... -1mha?dl=0
before.pdf pdf version is 1.3 (from Adobe Illustrator)
ImageMagick 6.9.2-5 Q16 x86_64 2015-11-09
Ghostscript 9.10 (2013-08-30)
the expected color of the line is #221E1F,
the resulting color is #090707.
At least white is ok
.
Any advice on how to proceed will be greatly appreciated.
PS: What i'm trying to achieve is to get the color of the line to be #000000, from a cmyk pdf to a cmyk jpeg / tiff. It's something I can achieve with Illustrator, but for some reason, I can't with imagick.
Re: How to have CMYK PDF retain original colors
Posted: 2016-01-27T21:37:03-07:00
by snibgo
Ghostscript v9.10 is very old. An upgrade might help.
I don't know which line is supposed to be #221E1F. Adobe viewer shows many lines. Perhaps they should all be that colour. But you only quote 3 channels, where CMYK has 4 channels.
Re: How to have CMYK PDF retain original colors
Posted: 2016-01-27T22:05:24-07:00
by fmw42
I tried on IM 6.9.3.1 Q16 Mac OSX with GS 9.16 and get your same results. I do not see anything significantly different about the files before and after, but the colors are different. The only potential issue I see in the verbose information is:
before:
pdf:Version: PDF-1.3
after:
pdf:Version: PDF-1.3 1 0 obj <<
I do not know if that is significant or not.
Even converting to sRGB, the results are visually different.
I think the IM developers may need to look at this. But it may end up being a GS issue. They will have to make the call.
Re: How to have CMYK PDF retain original colors
Posted: 2016-01-31T19:34:38-07:00
by patrick.h
Thanks for the very fast answers.
@snibgo: I updated ghostscript to version 9.15 and still have the same issue.
@fmw42: I am hoping that what you pointed out is significant.
Is the pdf i'm using saved in a format ImageMagick usually has difficulties with? I tried multiple formats using Illustrator and never get a perfect color match (before after conversion).
Is there a recommended format / settings table that would have a better chance of working?
A bit like this:
https://helpx.adobe.com/illustrator/usi ... files.html but with ImageMagick conversion in mind.
Converting everything to tiff is not a good solution for me, because of the file sizes.
Our work process is : get the original printableimage, collate it together in a grid with other printable images, and then print the whole thing.
Re: How to have CMYK PDF retain original colors
Posted: 2016-01-31T19:58:43-07:00
by fmw42
Sorry, I do not know what to do to make it work better. Perhaps you might report this on the Bugs forum and see what the developers say. Point back to your topic here.
Re: How to have CMYK PDF retain original colors
Posted: 2016-02-01T10:46:53-07:00
by fmw42
My only other thought is that your input pdf might be an embedded raster image (perhaps sRGB) in a vector pdf shell that is assigned CMYK. You would have to use something like pdfimage to extract the raster image and examine it.
How was your input pdf created? What tool? Was it a raster image before conversion to pdf or was it a vector image created in a vector-based tool?
Re: How to have CMYK PDF retain original colors
Posted: 2016-02-01T12:53:26-07:00
by snibgo
The embedded image is vector.
Perhaps a more obvious case could be generated. When I look at before.pdf and after.pdf in Adobe Viewer, I can't see any difference in the colours. What software was used to find "the resulting color is #090707"?
Re: How to have CMYK PDF retain original colors
Posted: 2016-02-01T14:07:25-07:00
by fmw42
I tried this, but compare gives differences.
Code: Select all
convert -colorspace sRGB before.pdf -profile /Users/fred/images/profiles/sRGB.icc -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc fred.pdf
compare -metric rmse before.pdf fred.pdf null:
6074.7 (0.092694)
Re: How to have CMYK PDF retain original colors
Posted: 2016-02-01T15:17:37-07:00
by snibgo
Well, if you take any image and change its colorspace, "compare" will give a numeric difference between them.
I'm trying to pin down what the problem is. I can't reproduce it. I don't know where the OP got these numbers:
patrick.h wrote:the expected color of the line is #221E1F,
the resulting color is #090707.
Re: How to have CMYK PDF retain original colors
Posted: 2016-02-01T15:52:27-07:00
by fmw42
Well, if you take any image and change its colorspace, "compare" will give a numeric difference between them
Most of the time, compare shows a reasonably close value.
Any idea how other to process the image. I have tried all sorts of -colorspace, -profile without getting close enough. I really do not see why the pdf gets changed.
What GS version do you have? Perhaps a bug in my GS 9.16(?)
Re: How to have CMYK PDF retain original colors
Posted: 2016-02-01T16:11:11-07:00
by snibgo
I hadn't even done a conversion. I downloaded the before and after pdfs. In Adobe Reader, the colours look the same.
Looking more closely, I was mistaken. pdfimages can't see any raster images, but that is because they are embedded inside other objects, within the PDF. I don't know if these rasters are involved in the output that Ghostscript makes.
Code: Select all
convert -density 1200 before.pdf -verbose info:
This makes a CMKY image, with the most common colour being cmyk(0,0,0,0), which is white. The next most common is cmyk(185,172,170,227), which is near black.
This is with IM v6.9.2-5 and GS v9.15.
Re: How to have CMYK PDF retain original colors
Posted: 2016-02-04T20:23:13-07:00
by patrick.h
Thanks guys for the pointers. I will try pdfimages later.
About where I took the colors from:
If I remember correctly, I was using a color picker on the files opened by Adobe Reader, just to compare the two pdfs using the same software.
The before pdf is generated from within Adobe Illustrator and, as far as I know is only vector based. However, my software should work for rasters as well
.
Zooming helps a lot to see the difference in color.