Can't get Distort to do interpolation

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
Searle

Can't get Distort to do interpolation

Post by Searle »

When i do this:

Code: Select all

    $image->Distort("method" => "Perspective",
        "points" => [ 0, 0 => 0.5, 0.5  ... ]
    );
i actually expect IM to interpolate the source pixels and calculate the target pixels.
But I can't get it running. I always get raw source pixels duplicated.

What i tried:
  • Patching IM for Distort to accept the arguments "interpolate", "filter" and "blur" and setting them. Didn't work.
  • Trying to do $image->Set("option", "distort:scale=3") which I found browsing the source code. Didn't work either.
I'm stuck :-(
Any ideas, somebody?

Cheers,
Searle
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Can't get Distort to do interpolation

Post by anthony »

It should work exactly as you defined. If only one point is given. the whole image will be shifted, by half a pixel right and down.

This works for me

Code: Select all

convert rose: +distort Affine '0,0 0.5,0.5' show:
generated a slightly blurred image as ALL the pixels are shifted diagonally half a pixel, and the colors interpolated produces some averaging of the colors.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Searle

Re: Can't get Distort to do interpolation

Post by Searle »

Thanks for helping.

I just understood the concept of virtual canvases which, together with
page.x and page.y attributes, helped. I'ts working fine now...

Cheers,
Searle
Post Reply