Convert PDF to JPEG

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
elisegev
Posts: 50
Joined: 2005-09-28T07:47:13-07:00
Contact:

Convert PDF to JPEG

Post by elisegev » 2006-02-21T08:29:54-07:00

I have a PDF file. When I convert it to JPEG, I cannot display the result in any browser (IE and Firefox). Firefox says: The image "..." cannot be displayed, because it contains errors.

This issue happens on Windows and Solaris with ImageMagick 6.2.5. The converted file can be displayed in any JPEG editor and in (im)display. The PDF file is 464Kb and the JPEG is 162 Kb. The PDF file is created with Adobe Illustrator as a layered document, where one of the layers is a JPEG file.

What could the problem be? How can I post the original file for other people to reproduce the problem?

User avatar
magick
Site Admin
Posts: 11015
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-02-21T13:36:49-07:00

Try adding -interlace none to your command line to create a non-progressive JPEG image. Some browsers cannot display progressive JPEG images.

elisegev
Posts: 50
Joined: 2005-09-28T07:47:13-07:00
Contact:

Post by elisegev » 2006-02-21T14:23:47-07:00

magick wrote: Try adding -interlace none to your command line to create a non-progressive JPEG image. Some browsers cannot display progressive JPEG images.


I tried adding '-interlace none' to the command, but got the same results.

The ImageMagick is 6.2.4 and not 6.2.5.

elisegev
Posts: 50
Joined: 2005-09-28T07:47:13-07:00
Contact:

Post by elisegev » 2006-02-22T13:39:07-07:00

I don't know much about how JPEG are stored and what standards they follow. It seems that this file, which is generated from a PDF file, has an Alpha channel. I get this information when loading the file with javax.imageio and java.awt.image packages. Are JPEG files allowed to have an alpha channel? Can it be turned off?

When loading the file as java.awt.image.BufferedImage, I get an javax.imageio.IIOException: Unsupported Image Type. But, it can be read as java.awt.image.Raster, which provides the above information.

elisegev
Posts: 50
Joined: 2005-09-28T07:47:13-07:00
Contact:

Re: Convert PDF to JPEG

Post by elisegev » 2006-02-22T14:42:17-07:00

tdromba wrote: Check to be certain the resultant jpeg is rgb, not cmyk. Some browsers will not display cmyk images, including FF. Add -colorspace RGB to the command as a start.

TD


Thanks! This suggestion worked. Now I can display the JPEG file in a browser. The original file was created with Adobe Illustrator and it says 'CMYK' in it.

Post Reply