(none) imager-devel
/ help / lists / applications / search /
 

Re: is there a rotate by 90 function?

From: Tony Cook (
03213@xyz.molar.is)
Date: Wed 12 Sep 2001 - 04:03:08 UTC

  • Next message: David Lai: "imager speed versus shell commands"

    On Tue, 11 Sep 2001, David Lai wrote:

    > Hello
    >
    > is there an easy way to rotate an image 90 degrees, either clockwise
    > or counterclockwise. rotate 180 can be done with a hv flip I think.
    > Thanks

    Current CVS includes a rotate() method, which can rotate by an exact angle
    or in units of 90 degrees:

      my $rot1 = $img->rotate(right=>90);
      my $rot2 = $img->rotate(degrees=>45);

    With 0.38 you could use the transform2() engine to do it:

      # untested
      my $rot3 = Imager::transform2({expr => 'return getp1(w-1-y, x)',
                                     width => $img->getheight(),
                                     height=> $img->getwidth() }, $img);

    Tony



  •