Hi Guys,
I could really use a hand....
I can convert a PDF file to PNG but not JPG - well not ones that open in everything.
I am using the command line:
convert source.pdf destination.jpg
The outputted JPG files open in Firefox 3.6 & Adobe Fireworks but just show as solid black images in Safari 5 and Preview on the Mac. They also show as broken images in Internet Explorer 8.
I'm using ImageMagick 6.5.9-0 2010-02-24 Q16 and GPL Ghostscript 8.70.
Here's a link to the PDF file: http://www.web-development-blog.co.uk/design_1328.pdf
Any help would be really appreciated.
Thanks,
Jim.
Can convert PDF to PNG but not JPG
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Can convert PDF to PNG but not JPG
When I open one of the jpg files with Paint Shop Pro it opens a warning dialog which says:
It then displays the image, but the colours are not the same as the PNG version (which looks correct).
I tried stripping the file and removing all profiles but PSP still generates this warning. It would appear that there's some sort of colour management specification in the JPG which some programs can't handle.
Pete
Code: Select all
The document's colors were converted to the working space
Embedded: European Print Medium GCR, 320 UCR
Working: sRGB Color space Profile.icm
I tried stripping the file and removing all profiles but PSP still generates this warning. It would appear that there's some sort of colour management specification in the JPG which some programs can't handle.
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
See my message in this topic for a link to a zip of all the files.
Re: Can convert PDF to PNG but not JPG
ImageMagick identifies your PDF as CMYK (the first page has only a RGB element, but the other pages have indeed CMYK colors). When you store your images as PNG, ImageMagick (internally) has to convert to RGB - as PNG can't store CMYK colors.
Unlike PNG, JPG can also store CMYK. So, IM doesn't have to change the colorspace here and stores the images from the PDF as CMYK JPGs. And some viewers have problems with CMYK.
In order to always get RGB JPGs, you have to use at least something like that:
convert source.pdf -colorspace RGB destination.jpg
One can usually get better colors by using color profiles - see here. (And apart from that, with PDFs, it's often better to call Ghostscript itself for getting perfect colors.)
But the differences in the colors are not that big in your case - so maybe the results with "-colorspace RGB" are ok for you.
Unlike PNG, JPG can also store CMYK. So, IM doesn't have to change the colorspace here and stores the images from the PDF as CMYK JPGs. And some viewers have problems with CMYK.

In order to always get RGB JPGs, you have to use at least something like that:
convert source.pdf -colorspace RGB destination.jpg
One can usually get better colors by using color profiles - see here. (And apart from that, with PDFs, it's often better to call Ghostscript itself for getting perfect colors.)
But the differences in the colors are not that big in your case - so maybe the results with "-colorspace RGB" are ok for you.