My goal is to extract about 30 JPG or PNG images from a PDF using PHP. I’m using ImageMagick from PHP in a shared hosting. Imagick::readImage. (PECL imagick ). Imagick::readImage — Reads image from filename. Description. bool Imagick::readImage (string $filename). Example case: extract page 1 of a pdf file and save it as jpg image. $i = new Imagick(); $i->setResolution();.

Author: Yozshulabar Madal
Country: Dominica
Language: English (Spanish)
Genre: Medical
Published (Last): 3 November 2018
Pages: 33
PDF File Size: 3.91 Mb
ePub File Size: 17.40 Mb
ISBN: 798-7-40371-577-2
Downloads: 34688
Price: Free* [*Free Regsitration Required]
Uploader: Kisar

Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? I’m using ImageMagick 6.

Imagick::readImage PHP Method Code Examples – HotExamples

I have tried several source PDFs having from 20 to 30 images each. It always works fine for the first 10 images, but starting at index X and thereafter it always gets an exception.


I tried the same test on another hosting account with PHP 7. It imagicj gives an exception in the readImage command when index is around 15 or higher depending on the source PDF.

Each page is essentially a big image. The code above works for the first X pages, then imagock with an exception. I’m trying to extract pages 0 to It seems that when you are reading a page that is far enough into the PDF file, it gets the exception.

The first page is [0] and you are requesting page [15] which would be the 16 page. The Imagemagick developers have nothing to do with Imagick.


Does it work with a simple convert command line? Select all convert bound.

If it still fails try reading 5 pages at a time which will hopefully isolate the problem. ImageMagick examples mostly using imagickk Imagick examples. They all fail on the readImage[X] command. Bear in mind this is running in PHP from a shared hosting account so I do not have a Command line environment to run a convert command.

  ICE 3005A PDF

To clarify, the entire script consists of only two lines. It is not running a loop and finally getting the exception on the 16th page. Do you have access to PHP execso that you could run the command line and see if that fails?