Page 1 of 1

Convert PDF to JPG/GIF

Posted: 2008-03-10T15:16:10-07:00
by bwacjay
I'm having repeated issues converting PDF's with transparency to any raster format, which I have attributed to problems that Ghostscript has with PDF transparency.

However, I've uncovered a new problem that seems to me to be related to IM, not GS, and I'm looking for some explanation of what's going on.

This PDF file: http://drop.io/8mfemel is a PDF created in InDesign CS3, exported to PDF, and form fields added in Acrobat 8. The original INDD file has some graphics that contain transparency.

When I use straight Ghostscript (through GSView 4.9 and Ghostscript 8.61) to convert the PDF file to JPG, I get a good rendering of the file, as shown here: http://bwacm.imagick.s3.amazonaws.com/s ... orrect.jpg

However, when I use IM (6.3.7) to do a 'convert spring.pdf spring.jpg' I get a bad rendering as shown here: http://bwacm.imagick.s3.amazonaws.com/s ... roblem.jpg . I have also tried 'convert -alpha on spring.pdf spring.jpg' with the same results.

I understand that JPG doesn't support transparency, but the problem is also identically visible when converting to a GIF, and all the transparency in the INDD file should have been flattened before exporting. I get a couple errors when running the IM command, but they are related to fonts not being embedded, and I'm pretty sure this is unrelated.

Any explanation on why I'm getting different results from GS and IM (which passes all PDf related renderings directly to GS, as I understand it) would be greatly appreciated.

Thanks.

Re: Convert PDF to JPG/GIF

Posted: 2008-03-12T21:29:26-07:00
by fmw42
Actually I have no idea what is really going on, but have you tried to upgrade to the latest version of IM 6.3.9-x. The folks at IM are constantly improving things and perhaps there was some change made recently that has fixed an issue with the use of Ghostscript.

You might also search the archives here to see if there was any reported issue or upgrade regarding Ghostscript

Re: Convert PDF to JPG/GIF

Posted: 2008-03-13T06:47:28-07:00
by magick
We're using Ghostscript 8.61 and ImageMagick 6.3.9. With this command we get the expected results:
  • convert -colorspace rgb spring.pdf spring.jpg

Re: Convert PDF to JPG/GIF

Posted: 2008-03-13T08:28:54-07:00
by bwacjay
Thanks for the help. I didn't realize that the version I was using wasn't current -- I just installed it about a month ago, I think.

I'll update the version, run the recommended command and see what results I get. It'll be later today before I can get to it, then I'll post the results.

Thanks again for the help!

Re: Convert PDF to JPG/GIF

Posted: 2008-03-16T21:00:38-07:00
by bwacjay
I updated the version of IM with the same results. However, I used the -colorspace rgb option and it worked perfectly on my local box. Maybe this was the problem all along.

I'll make the change in my webapp and see if the results are improved there as well.

Thanks for your suggestions. Any ideas why using the colorspace option would elminate this problem? I do not have a great working knowledge of colorspace except that it's supposed to help match colors more closely which is not my problem here...

Thanks again,
Jay

Re: Convert PDF to JPG/GIF

Posted: 2008-03-17T17:28:00-07:00
by anthony
The -colorspace is a 'hack' to give IM a clue about how to handle ghostscript. See IM examples, Common Formats, Postscript for notes about this...
http://imagemagick.org/Usage/formats/#ps

Basically it tells IM to switch to a pngalpha outptu device when using ghostscript.

IT is extremely difficult for IM to handle postscript, as it can not read and determine what a postscript "program" is attempting to do. Postscript is a full computer language, not just a image file format, and this is the reason for the problems.