ImageMagick only reads first page of pdf/ps doc. (6.5.5-7)
Posted: 2009-09-08T15:02:55-07:00
Using the macports version of ImageMagick (6.5.5-7 2009-09-08 Q8 OpenMP) on Mac OSX 10.6 (Snow Leopard)
After upgrading to snow leopard and updating ImageMagic, I noticed that my app that generates preview of pdf uploads was only processing the first page. Threw together a little ruby and perl script to show the number of pages returned by Read, both seem to only return the first page. The same scripts on a MacOS 10.5 or on a Linux system with ImageMagic 6.5.4-0 correctly shows the number of pages in the pdf or postscript document. I've tested this with multiple pdf and ps documents, same results every time. Pls. advice.
-- Perl script --
#!/usr/local/bin/perl
use Image::Magick;
my($image, $x);
$image = Image::Magick->new;
$image->Read($ARGV[0]);
for ($x = 0; $image->[$x]; $x++){
print "Found page $x \n";
}
-- Ruby Script --
require "rubygems"
require 'RMagick'
ARGV.each do |arg|
images = Magick::Image.read(arg)
puts images.size
end
After upgrading to snow leopard and updating ImageMagic, I noticed that my app that generates preview of pdf uploads was only processing the first page. Threw together a little ruby and perl script to show the number of pages returned by Read, both seem to only return the first page. The same scripts on a MacOS 10.5 or on a Linux system with ImageMagic 6.5.4-0 correctly shows the number of pages in the pdf or postscript document. I've tested this with multiple pdf and ps documents, same results every time. Pls. advice.
-- Perl script --
#!/usr/local/bin/perl
use Image::Magick;
my($image, $x);
$image = Image::Magick->new;
$image->Read($ARGV[0]);
for ($x = 0; $image->[$x]; $x++){
print "Found page $x \n";
}
-- Ruby Script --
require "rubygems"
require 'RMagick'
ARGV.each do |arg|
images = Magick::Image.read(arg)
puts images.size
end