Page 1 of 1

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

Posted: 2013-01-30T07:41:32-07:00
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?

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

Posted: 2013-01-30T10:38:19-07:00
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.

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

Posted: 2013-01-30T12:58:18-07:00
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.

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

Posted: 2013-01-30T13:22:57-07:00
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.

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

Posted: 2013-01-31T04:17:18-07:00
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.

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

Posted: 2013-01-31T10:23:03-07:00
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.

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

Posted: 2013-02-04T06:24:16-07:00
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.

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

Posted: 2013-02-04T07:48:26-07:00
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.