this command line crash: gswin32c -sDEVICE=pdfwrite -dConvertCMYKImagesToRGB=true -sOutputFile=test.pdf input.pdf If I Use the duseicecolor=true it does not crash but the output file is not readeable... Is there any way to convert my cmyk pdf to rgb one?
First I would suggest trying a more recent version of Ghostscript, the current release is 8.71. If that continues not to work, please attach a sample file here.
Created attachment 5954 [details] cmyk pdf
I try it with gs 8.70 win32, still the same. There is no 8.71 binaries for windows. Here is a cmyk PDF that produce the problem.
segfault with svn trunk r10710 (that's a few commits before the 8.71 freeze); with ghostpdl language switch build against icc_branch r10720, it generates a 370k pdf which is incomplete but no error message. Adding Michael for the latter problem.
any news about a solution?
The seg fault is also caused by a colour space. During a grestore the colour space (pgs->color_space) is pointing at what appears to be uninitialised memory. Since it processes correctly when we don't convert the images I guess this is the source of the problem, though I can't see why. The exhibit file is large and complex, this will take some considerable time to work through.
Created attachment 6354 [details] Additional (simple) test case Attached you will find a new test case for this bug. It contains a single page with a CMYK image.
Hi Ken, I also stumbled about this. Would be nice if this could be fixed. Looks like pdfwrite crashes as soon as ConvertCMYKImagesToRGB=true is defined and a CMYK image is present. Strange enough, if ColorConversionStrategy=/sRGB is defined (and ConvertCMYKImagesToRGB=false), the file is created with no obvious errors (and as far as I understand it, the image will be converted to RGB in that case also). To help you I added an additional test case. The bug is existing in the following GS versions: 8.56, 8.60, 8.62, 8.63, 8.70, 8.71 8.54 works properly Kind regards, Markus
(In reply to comment #8) > Strange enough, if ColorConversionStrategy=/sRGB is defined (and > ConvertCMYKImagesToRGB=false), the file is created with no obvious errors (and > as far as I understand it, the image will be converted to RGB in that case > also). Its a 'calibrated RGB' space. In PostScript terms this is a CIE colour space. It is only properly represented in a PDF file by using an ICCBased colour space, though the CalRGB space is a reasonable approximation. Although these are both 3 component spaces, the ICCBased space will result in an image which is not exactly RGB.
(In reply to comment #9) > (In reply to comment #8) > > Strange enough, if ColorConversionStrategy=/sRGB is defined (and > > ConvertCMYKImagesToRGB=false), the file is created with no obvious errors (and > > as far as I understand it, the image will be converted to RGB in that case > > also). > Its a 'calibrated RGB' space. In PostScript terms this is a CIE colour space. > It is only properly represented in a PDF file by using an ICCBased colour > space, though the CalRGB space is a reasonable approximation. > Although these are both 3 component spaces, the ICCBased space will result in > an image which is not exactly RGB. Thank you for this information. What is the status of this bug? It looks like ConvertCMYKImagesToRGB does not work at all currently.
(In reply to comment #10) > What is the status of this bug? > It looks like ConvertCMYKImagesToRGB does not work at all currently. It appears to be a bug, it has not been reported by a commercial customer and so does not get a high priority. It will be dealt with when developer time is available.
(In reply to comment #11) > It appears to be a bug, it has not been reported by a commercial customer and > so does not get a high priority. It will be dealt with when developer time is > available. OK. Please tell me if I can help in any way.
In fact it is not the presence of a CMYK image which causes the problem. The issue arises because both example files contain an imagemask. Imagemasks do not have a colour space of their own, they are drawn using the current colour and space. The code for converting CMYK images to RGB was checking the image colour space to see if it was CMYK before converting, but the masks have a NULL colour space, dereferencing this causes a crash. Revision 11744: http://ghostscript.com/pipermail/gs-cvs/2010-September/011766.html resolves this by checking for a NULL colour space, if it is NULL we know this is a mask, and masks never need to be converted, so we can simply return, setting the conversion to false. It appears, however, that the ICC colour work has broken the implementation, images in CMYK are not converted to RGB, because pdfwrite doesn't see them as CMYK, it sees them as ICC. I'll open a new bug report for this and consult with our colour expert later this week.