Can't open in Android JPEG or JPG images converted from PDF

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
Johnny Well
Posts: 4
Joined: 2013-01-30T07:34:57-07:00
Authentication code: 6789

Can't open in Android JPEG or JPG images converted from PDF

Post by Johnny Well »

Hello Everybody, i'm trying to convert some PDF into JPG files and use this files on android, but they just don't open in this system.

I was using Wand for python, but i tryed directly on shell just doing convert file.pdf file.jpg and this don't worked too

Someone can help me with this?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can't open in Android JPEG or JPG images converted from

Post by fmw42 »

Perhaps your pdf is defined for cmyk. Some systems cannot handle cmyk jpgs. Try to convert your pdf to rgb first

convert -colorspace sRGB input.pdf output.jpg

Or just check the IM verbose info on your pdf and see if it is cmyk first.
Johnny Well
Posts: 4
Joined: 2013-01-30T07:34:57-07:00
Authentication code: 6789

Re: Can't open in Android JPEG or JPG images converted from

Post by Johnny Well »

fmw42 wrote:Perhaps your pdf is defined for cmyk. Some systems cannot handle cmyk jpgs. Try to convert your pdf to rgb first

convert -colorspace sRGB input.pdf output.jpg

Or just check the IM verbose info on your pdf and see if it is cmyk first.
Doing this way works fine, thanks.

But have one more detail, i'm using wand for python and to do this i need set the image.type atribute, for RGB this is "truecolor" but if i change this atribute the image become whitish.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can't open in Android JPEG or JPG images converted from

Post by fmw42 »

But have one more detail, i'm using wand for python and to do this i need set the image.type atribute, for RGB this is "truecolor" but if i change this atribute the image become whitish.
I am not that familiar with any of the IM APIs. But I doubt that the type attribute is what you want to use. It is related to the colorspace not type.
Johnny Well
Posts: 4
Joined: 2013-01-30T07:34:57-07:00
Authentication code: 6789

Re: Can't open in Android JPEG or JPG images converted from

Post by Johnny Well »

Hong Minhee, the guy who makes the Wand bind told me that colorspace reflects in type attribute.

I'm working with images for the first time and i haven't experience with this, then i can't say what i think is correct.

Have some aspect what changes just this whitish in image?

If i convert the PDF to PNG directly from shell the whitish happens too.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can't open in Android JPEG or JPG images converted from

Post by fmw42 »

Post a link to an example pdf that does not work correctly. Also identify your exact command and your version of IM and platform.
Johnny Well
Posts: 4
Joined: 2013-01-30T07:34:57-07:00
Authentication code: 6789

Re: Can't open in Android JPEG or JPG images converted from

Post by Johnny Well »

PDF --> http://dl.dropbox.com/u/86138930/stock.pdf

Whitish JPG --> http://dl.dropbox.com/u/86138930/stock.jpg (this is from wand)

Normal JPG --> http://dl.dropbox.com/u/86138930/stock_rgb.jpg (this is from shell)

When i convert from shell with "convert stock.pdf -colrspace RGB stock.jpg" thats work fine.
But in Wand (http://pypi.python.org/pypi/Wand) i have to do like this http://docs.wand-py.org/en/latest/guide/colorspace.html
but the resultant image isn't the same.

Both images are the truecolor type in wand, but one is normal and other whitish.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can't open in Android JPEG or JPG images converted from

Post by snibgo »

Your shell command "convert stock.pdf -colorspace RGB stock.jpg" converts the image to the colorspace RGB, instead of the usual sRGB. Then it stores the image with a flag that says it is sRGB.

You need to find the equivalent wand-python commands that do this. I know nothing about wand-python.
snibgo's IM pages: im.snibgo.com
Post Reply