How to use "Set(extract=>geometry)" . . .

ademmler <[email protected]>
Newsgroups gmane.comp.video.image-magick.devel
Message-ID <[email protected]>
Hi IM Gurus!

I am trying to extract a area from a given PDF file.
I thought of using some thing like "$image->Set(extract=>100x100+10 
+10)".
But I always get the whole image. Help would be nice!

Thanks Alex

Here is my code:
#!/usr/perl -w

use strict;
use Image::Magick;

my $infile = shift;
my $out = $infile;
$out =~ s/.pdf$|.gs$/.tif/i;
	

## read image
my $image = Image::Magick->new;
$image->Set(depth=>8);
$image->Set(colorspace=>'CMYK');
$image->Set(depth=>8);
$image->Set(density=>'150');
$image->Set(extract=>'100x100+10+10');

my $readimage = $image->Read($infile);
	die "Can't read Image: $readimage\n" if "$readimage";

## get image infos
print "Get Image Infos:\n";	

my @info = $image->GetAttribute(colorspace =>'True', verbose=>'True');
print"@info\n";

my ($width, $height) = $image->Get('width','height');
print"Dimension: $width x $height\n";

my $bbox =$image->Get('bounding-box');
print "BoundingBox: $bbox\n";

my $colors = $image->Get('colors');
print"Colors: $colors\n";

my ($xres, $yres) = $image->Get('x-resolution','y-resolution');
print"Resolution: $xres x $yres\n";



## write image and open it
my $write = $image->Write(filename=>"$out", compression=>'none');
	die "Cant  write outfile $out ($!)\n" if "$write";
	
system("open $out");

exit 0;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.