PDF to JPEG Conversion - Color Conversion Issue

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
ralphcapasso

PDF to JPEG Conversion - Color Conversion Issue

Post by ralphcapasso »

I am attempting to convert a PDF to a JPEG image and the resulting image appears washed out (increased brighness). If I create the JPEG through Ghostscript directly, it appears correctly.

I have tried with ImageMagick-6.5.2-Q16 and ImageMagick-6.4.4-Q16 on Windows XP and Windows 2003.

Command:
convert -density 300 -verbose -profile "c:\temp\img\USWebCoatedSWOP.icc" -profile "c:\temp\img\sRGB Color Space Profile.icm" C:\temp\img\input.pdf[0] c:\temp\output.jpg

Verbose (JPEG conversion):
[ghostscript library] Files/gs/gs8.61/bin/gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=bmpsep8" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300" -dUseCIEColor -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-RNlLwpmA" "-fC:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-MLsxHM7v" "-fC:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-ed018zNj"C:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-RNlLwpmA[0] BMP 1725x1716 1725x1716+0+0 8-bit PseudoClass 256c 11.32mb 0.188u 0:01
C:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-RNlLwpmA[1] BMP 1725x1716 1725x1716+0+0 8-bit PseudoClass 256c 11.32mb 0.125u 0:01
C:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-RNlLwpmA[2] BMP 1725x1716 1725x1716+0+0 8-bit PseudoClass 256c 11.32mb 0.078u 0:01
C:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-RNlLwpmA[3] BMP 1725x1716 1725x1716+0+0 8-bit PseudoClass 256c 11.32mb
C:\temp\img\000000804644_BK_RS_01_01_01.pdf[0]=>C:\temp\img\000000804644_BK_RS_01_01_01.pdf PDF 1725x1716 1725x1716+0+0 16-bit DirectClass 11.32mb 0.250u 0:01
C:\temp\img\000000804644_BK_RS_01_01_01.pdf[0]=>\\usmddmdfs01\dev-users\rcapasso\pdf\output.bmp PDF 1725x1716 1725x1716+0+0 16-bit DirectClass 8.471mb 0.453u 0:01

All files used to generate the output:
https://proxy.global-aoma.com/aomapicku ... 090512.zip
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF to JPEG Conversion - Color Conversion Issue

Post by magick »

Try removing your -profile options and instead add '-colorspace rgb' before your PDF image. Does that give you the expected results?
ralphcapasso

Re: PDF to JPEG Conversion - Color Conversion Issue

Post by ralphcapasso »

The conversion yields different output, however, the covers are extremely dark.

Here is the command I ran:
convert -density 300 -verbose -colorspace rgb C:\temp\img\input.pdf[0] c:\temp\output.jpg

Here is the output file:
https://proxy.global-aoma.com/aomapicku ... 090513.zip

Here is the process output:
[ghostscript library] Files/gs/gs8.61/bin/gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300" -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-id_3XD21" "-fC:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-bRliefjQ" "-fC:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-WEYeXwSH"C:/DOCUME~1/DEV~1.COR/LOCALS~1/Temp/magick-id_3XD21 PNM 1725x1716 1725x1716+0+0 8-bit DirectClass 8.469mb
C:\temp\img\000000804644_BK_RS_01_01_01.pdf[0]=>C:\temp\img\000000804644_BK_RS_01_01_01.pdf PDF 1725x1716 1725x1716+0+0 16-bit DirectClass 8.469mb
C:\temp\img\000000804644_BK_RS_01_01_01.pdf[0]=>\\usmddmdfs01\dev-users\rcapasso\pdf\output.jpg PDF 1725x1716 1725x1716+0+0 16-bit DirectClass 138kb 0.141u 0:01


Thanks,
Ralph
ralphcapasso

Re: PDF to JPEG Conversion - Color Conversion Issue

Post by ralphcapasso »

One minor follow-up I did some testing with ImageMagick-6.1.9-Q16 and found that the conversion output is rendered correctly using the same commands included in my previous post.

Any idea what changes were made to ImageMagick that caused this issue?

Thanks,
Ralph
ralphcapasso

Re: PDF to JPEG Conversion - Color Conversion Issue

Post by ralphcapasso »

Do you have any update on this issue? Do you need any additional test files?

I noticed that version 6.5.x applies the Ghostscript color option "-dUseCIEColor" for all CMYK pdfs where 6.1.9 does not have this option. I was hoping to disable it via the delegates.xml file, but it appears to be hard-coded in pdf.c.

if (cmyk != MagickFalse)
(void) ConcatenateMagickString(options,"-dUseCIEColor ",MaxTextExtent);

Thanks,
Ralph
Post Reply