This queue is for tickets about the Imager CPAN distribution.

Maintainer(s)' notes

Tickets for Imager are now on github at https://github.com/tonycoz/imager

Report information
The Basics
Id:
18712
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
TONYC [...] cpan.org
Requestors:
mario.menis [...] ptcommunication.it
Cc:
AdminCc:

BugTracker
Severity:
Important
Broken in:
0.50
Fixed in:
(no value)



Subject: Paste method problem
Hi I've found that paste method result broke when paste a source image which bottom source exceed 600px I've notice the same problem even with "height" param when top + height
Show quoted text
> 600px
Think that tha same issue will affect even crop method.. but I couldn't test enought. I'm using fedora 4 with kernel 2.6.11 x86_64 and perl 5.8.6. Compiled jpegsrc.v6b jpeg library for jpeg support under Imager 0.50. I've tested only jpg files. Hope I could help Bye Mario
Please provide some sample code that reproduces the problem. I had a look through the code involved in Imager and don't see anything wrong at first look. Code that reproduces the problem will let me diagnose and fix it as soon as possible. Thanks. Tony
Subject: Re: [rt.cpan.org #18712] Paste method problem
Date: Fri, 14 Apr 2006 11:35:19 +0200
To: bug-Imager@rt.cpan.org
From: "Mario Menis - PT Communication S.r.l." <mario.menis@ptcommunication.it>
Hi!
This is what I've found:

use strict;
use Imager;

my $ImgFile1 = "./template/promemoria/messaggio.jpg";
my $img1 = Imager->new();
$img1->read(file=>$ImgFile1) or die $img1->errstr();

Show quoted text
# This doesn't work ( well.. it result in a wrong pasting.. it seems that bottom (src_maxy) source img will set to max img height instead 610..
#$img1->paste(top=>544,
#             left=>72,
#             src_minx => 30,#30,
#             src_miny => 580,#715,
#             src_maxx => 120,#120,
#             src_maxy => 610,#728,
#             #height => 10,
#            #width => 90,
#             img=>$img1
#             );

Show quoted text
# This WORKS
Imager::i_copyto($img1, $img1, 30, 715, 120, 728, 72,544 );


$img1->write(type=>"jpeg", file=>'mio.jpeg') or die $img1->errstr();

hope it can be usefull...
Bye
Mario

Il giorno ven, 14-04-2006 alle 05:26 -0400, via RT ha scritto:
Show quoted text
<URL: http://rt.cpan.org/Ticket/Display.html?id=18712 >

Please provide some sample code that reproduces the problem.

I had a look through the code involved in Imager and don't see anything
wrong at first look.  Code that reproduces the problem will let me
diagnose and fix it as soon as possible.

Thanks.
Tony
Ok, I think I see the problem now. The code is checking src_maxx instead of src_maxy when checking for bottom of image parameters. This means that: $im1->paste(src=>$im2, left => 20, right=>20, src_maxx => 20); or: $im1->paste(src=>$im2, left=>20, right=>20, src_maxy => 20); will produce unexpected results. In the first case because it sees src_maxx set and tries to use the undefined src_maxy, in the second case because src_maxy is ignored. If you change line 629 of Imager.pm from: if (defined $input{src_maxx}) { to: if (defined $input{src_maxy}) { and re-install that should fix the problem I see. If you get a chance please try this out to see if it fixes the problem for you. If it doesn't please let me know. I'll be doing a 0.51 release with this and 2 other fixes in the near future.
Subject: Re: [rt.cpan.org #18712] Paste method problem
Date: Fri, 14 Apr 2006 12:34:19 +0200
To: bug-Imager@rt.cpan.org
From: "Mario Menis - PT Communication S.r.l." <mario.menis@ptcommunication.it>
Sure!!! So i've got the problem over 600px because my src img was effective 600 px width  !!!!
I've correct that line and now it works perfectly!!
Tanks very much!
Wish a good day and nice easter!
Tnx
Mario



Il giorno ven, 14-04-2006 alle 06:22 -0400, via RT ha scritto:

Show quoted text
<URL: http://rt.cpan.org/Ticket/Display.html?id=18712 >

Ok, I think I see the problem now.

The code is checking src_maxx instead of src_maxy when checking for
bottom of image parameters.

This means that:

  $im1->paste(src=>$im2, left => 20, right=>20,
              src_maxx => 20);

or:

  $im1->paste(src=>$im2, left=>20, right=>20,
              src_maxy => 20);

will produce unexpected results.

In the first case because it sees src_maxx set and tries to use the
undefined src_maxy, in the second case because src_maxy is ignored.

If you change line 629 of Imager.pm from:

    if (defined $input{src_maxx}) {

to:

    if (defined $input{src_maxy}) {

and re-install that should fix the problem I see.

If you get a chance please try this out to see if it fixes the problem
for you.  If it doesn't please let me know.

I'll be doing a 0.51 release with this and 2 other fixes in the near future.

Subject: Re: [rt.cpan.org #18712] Paste method problem
Date: Fri, 14 Apr 2006 13:29:26 +0200
To: bug-Imager@rt.cpan.org
From: "Mario Menis - PT Communication S.r.l." <mario.menis@ptcommunication.it>
Just find another problem about it...
in some cases bottom coords still exit wrong..

I've found this in the Imager.pm  on line 649 ( I think you line is 4/5 line upper)

  $src_bottom > $r and $src_bottom = $b;

And changed in:

  $src_bottom > $b and $src_bottom = $b;

This seems to fix it..

Hope to be helpful..

Bye
Mario








This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.