Page 1 of 1

Only text or images coming up after conversion

Posted: 2014-05-29T09:50:27-07:00
by jagbir
I am facing one issue while converting PDF to Images (jpg or png). If a page of pdf contains only text or only image, then it converts it into correct image. But if a pdf page contains images and texts then the converting image will only contain the texts. Would really appreciate the help to resove this. I've downloaded latest imagemagick 6.8.9-1 on Ubuntu 12.04 OS. Let me know what more info I can provide you to help debug this.

Command I'm using for conversion:

Code: Select all

$ convert sample.pdf[0] -colorspace RGB -geometry 551 one.jpg

Re: Only text or images coming up after conversion

Posted: 2014-05-29T09:58:35-07:00
by fmw42
convert sample.pdf[0] -colorspace RGB -geometry 551 one.jpg
I see several problems with this command.

1) for vector formats such as pdf, if the colorspace is not sRGB, then put -colorspace before reading the pdf
2) your are creating a linear RGB colorspace and probably need to use sRGB
3) -geometry is likely doing nothing here as it is a setting and not an operator. if you are trying to resize the image, then you need to use -resize <geometry>. if you are trying to offset the image, then you need -page

Best guess is the following

Code: Select all

convert -colorspace sRGB sample.pdf[0] -resize 551 one.jpg
If that is not what you want, then explain what you are trying to do with -geometry and upload your pdf to dropbox.com (public folder) and put a link here so we can test with your sample.pdf

Re: Only text or images coming up after conversion

Posted: 2014-05-29T23:54:53-07:00
by mca.saurabhgupta
We have still no luck. We have tried to convert the second page of pdf to image but only text is showing in the resulting image. Image on second page of pdf is not appearing in the resulting image. We have used the below command :

Code: Select all

convert -colorspace sRGB /path_to_folder/CLA.pdf[1] -resize 551 /path_to_folder/two.jpg
Please find the link of the pdf which we are trying to convert.
https://dl.dropboxusercontent.com/u/70013623/CLA.pdf

Re: Only text or images coming up after conversion

Posted: 2014-05-30T01:38:34-07:00
by snibgo
IM v6.8.9-0 on Windows 8.1, with Ghostscript c9.10. This works fine for me:

Code: Select all

convert -colorspace sRGB CRA.pdf[1] x.jpg
According to Adobe Reader, the only text on that page is two lines at bottom-left. The text and image are both in x.jpg.

Try it with "-verbose" at the start. What version of GS is used?

Re: Only text or images coming up after conversion

Posted: 2014-06-03T02:34:48-07:00
by mca.saurabhgupta
Hi Team,

I have updated ImageMagick to the latest 6.8.9-2 version. Now we have ImageMagick 6.8.9-2 and GhostScript 9.14 on Ubuntu 12.04 OS.

When I have run the below command :

Code: Select all

convert -colorspace sRGB /path_to_folder/CLA.pdf[1] -resize 551 /path_to_folder/two.jpg
I have got the below error messages :

Code: Select all

convert: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/501.
convert: no images defined `two.jpg' @ error/convert.c/ConvertImageCommand/3187.
and below is the output in verbose mode :

Code: Select all

"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dFirstPage=2 -dLastPage=2 "-sOutputFile=/tmp/magick-7598K3T5JUVmVlOz%d" "-f/tmp/magick-7598wo_SIgJ7pa1r" "-f/tmp/magick-75985IwMJI34r7dk"
convert: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/501.
convert: no images defined `two.png' @ error/convert.c/ConvertImageCommand/3187.
Please find the output image of the second page on the below url :
https://dl.dropboxusercontent.com/u/70013623/two.jpg

I have tried to generate jpg and png image but in both case I have got the same error messages.

Re: Only text or images coming up after conversion

Posted: 2014-06-03T10:16:18-07:00
by fmw42
Did your install include all the delegate libraries. What do you get from running

convert -version

It should list all the Delegates that IM found.

Re: Only text or images coming up after conversion

Posted: 2014-07-06T22:48:00-07:00
by mca.saurabhgupta
Hi there,

Sorry for delayed response. When I am running the below command :

Code: Select all

convert -version
Then I am getting the below output :

Code: Select all

Version: ImageMagick 6.8.9-2 Q16 x86_64 2014-06-03 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype jpeg lcms tiff x zlib

Please look into it.



Thanks,
Saurabh

Re: Only text or images coming up after conversion

Posted: 2014-07-07T06:38:27-07:00
by snibgo
PNG isn't listed, so your build didn't include it. You probably need to rebuild delegates first, before IM.