On Wed, 19 Nov 2008 13:34:32 -0700
"Gorsuch, Ryan" <[EMAIL PROTECTED]> wrote:
>I'd like to enlarge a PDF and save it as a JPG, and I found a similar
>post (excerpt below) regarding EPS. But when I try a similar approach in
>Perl, ImageMagick complains:
>
> use Image::Magick;
> my $p = new Image::Magick;
> $p->Set( 'density' => "300x300" );
> $p->Read( "doc.pdf" );
> $p->[0]->write("doc.jpg");
>
Your code runs without error for me on linux, Perl 5.8.8 and IM6.4.3,
but the jpg has a washed out look.
>However, if I run the exact same script on the same document and set the
>density to 72x72 or anything less, there are no complaints, but the
>document has not been enlarged. If I open the document in Adobe Reader,
>I can zoom to 3200% with great clarity of fonts, but if I use
>PerlMagick's Resize function, the image is first rasterized, then
>resized, and the resulting image loses the sharp edges on the fonts.
>
>Does anyone know how to accomplish this?
>
>Ryan
You might want to look at:
http://imagemagick.org/Usage/formats/#vector
and see that pdf's do not enlarge well.
I did find this seems to work well on a pdf of test fonts:
It is slow though.
#########################################
#!/usr/bin/perl
use warnings;
use strict;
use Image::Magick;
# shell version
#convert -verbose -colorspace RGB -resize 1800 -interlace none \
# -density 300 -quality 100 doc.pdf doc1.jpg
my $p = new Image::Magick;
#must be before read image
$p->Set( 'density' => "300x300" );
$p->Quantize( 'colorspace' => 'RGB');
$p->Set( 'interlace' => 'None' );
$p->Resize('200%');
$p->Read( "doc.pdf" );
$p->set('quality'=> 100, );
$p->set('compresion'=> 'LosslessJPEG' );
$p->set('magick'=> 'jpg');
$p->Trim(); #added trim and border
$p->Border('width'=>20,'height'=>20);
$p->[0]->write("doc2.jpg");
__END__
Just Another Perl Hacker( not an IM guru :-) ),
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/Remember_How_Lucky_You_Are.html
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users