Ashish  Kumar Saxena
Ashish Kumar Saxena

Reputation: 4710

how to convert Pdf to image via imagemagick command?

I am using following environment:

Ubunut : 11.0 (virtual machine) Imagemagick : ImageMagick-6.9.3-7

I have execut following command:

wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz
ls
cd ImageMagick<version number here>/
./configure
make clean
make
sudo make install
ldconfig /usr/local/lib

After executing below command:

make check

40 test case 39 pass only 1 is fail (FAIL: tests/wandtest.tap 1)

Now i want to convert pdf file to jpg via command:

convert test.pdf test.jpg

convert: no decode delegate for this image format PNG' @ error/constitute.c/ReadImage/501. convert: no images definedtest.jpg' @ error/convert.c/ConvertImageCommand/3252

convert test.pdf test.png

convert: no decode delegate for this image format PNG' @ error/constitute.c/ReadImage/501. convert: no images definedtest.png' @ error/convert.c/ConvertImageCommand/3252.

anyone can suggest me how can i do ?

Upvotes: 1

Views: 3957

Answers (3)

HobPet
HobPet

Reputation: 662

It may be that the issue is not with the writing but with the reading of the PDF itself. Check the ImageMagick policy.xml.

sudo nano /etc/ImageMagick-6/policy.xml

Find the PDF and change to this:

 <policy domain="coder" rights="read|write" pattern="PDF" />

This solved for me.

Upvotes: 2

Arnaud Weil
Arnaud Weil

Reputation: 2502

Same problem. Solved it with:

apt-get -y install ghostscript

Upvotes: 0

Caleb
Caleb

Reputation: 5438

ImageMagick uses assorted external libraries to do its dirty work as far as input and output handling goes for various formats. In your case:

  • For reading PDFs, you need to have Ghostscript installed. Also it needs to be in your path as gs in order to work, so don't use that for some other shell alias. For more details see: https://superuser.com/q/819277/33767

  • For writing PNGs you'll need libpng.

Once those things are on your system (and in the case you compiled IM yourself, on your system at the time of compile) you should be golden.

Upvotes: 2

Related Questions