-----Original Message-----
From: Gretar Mar Hreggvidsson [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 28, 2006 5:29 PM
To: Nagasamudram, Prasanna Kumar
Cc: beginners@perl.org
Subject: Re: Image split....

Hi

I would probably use the module Imager (see CPAN), and it's crop() 
function.  The function doesn't modify the source, it returns a new, 
cropped image based on the coordinates you submit to it.

Best regards,
Grétar Mar

Nagasamudram, Prasanna Kumar wrote:
> Hi All
> 
>  
> 
> Can anybody suggest me any module/script that can be used to split and
> image into pieces?
> 
>  
> 
> I tried to search in CPAN also googled a lot.
> 
>  
> 
> I could only find image splitting software......but I need command line
> utility.
> 
>  
> 
>  
> 
> Thanks
> 
> Prasanna
> 
> 




Hi Gretar


Thanks a lot and that's exactly what I needed.

I have a small query related to this.


The following is my code which works perfectly fine for a BMP.

use Imager;

my $img = Imager->new();
$img->read(file=>'p.bmp', type=>'bmp') or die $img->errstr();

$newimg = $img->crop(left=>0, right=>510, top=>0, bottom=>384); 
$newimg->write(file=>"t1.bmp") or die $newimg->errstr();



But If I change the following line

$img->read(file=>'p.bmp', type=>'bmp') or die $img->errstr();

                   TO
$img->read(file=>'p.jpg', type=>'jpg') or die $img->errstr();



I get the following error.


"format 'jpg' not supported at i.pl line 4."


The same is for other formats....except bmp.

Is this a limitation or I'm I doing something wrong?

Thanks
Prasanna

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to