(the new) -distort Resize method in PerlMagick?

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

(the new) -distort Resize method in PerlMagick?

Post by NicolasRobidoux »

What needs to be done to add a method already in IM to PerlMagick?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: (the new) -distort Resize method in PerlMagick?

Post by magick »

Are you sure it doesn't work already? The $im->Distort() method is supported by recent versions of PerlMagick.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: (the new) -distort Resize method in PerlMagick?

Post by NicolasRobidoux »

I'll check and report back. Perl "Distort" did not appear to take the "resize" option according to the documentation http://www.imagemagick.org/script/perl-magick.php ("only" Affine, AffineProjection, Bilinear, Perspective, ScaleRotateTranslate), hence the question.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: (the new) -distort Resize method in PerlMagick?

Post by NicolasRobidoux »

'Can't seem to figure how to get -distort resize to work from PerlMagick.

-----

Now:

I am doing some consulting for a private company that does all its image
processing with PerlMagick.

I'd like them to be able to use -distort resize, because of http://imagemagick.org/discourse-server ... 22&t=18514
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: (the new) -distort Resize method in PerlMagick?

Post by fmw42 »

My guess is that -distort resize is too new and has not yet been folded into Perlmagick
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: (the new) -distort Resize method in PerlMagick?

Post by anthony »

The low level MagicCore Distort resize method take two arguments, both an integer (even though it is floating-point input) of the exact final size of the image. No aspect ratio handling or other special flags that a resize geometry argument provides.

The CLI for distort Resize does the processing of geometry to final integer size, just like it would -resize, and other resize like operations too. The other API's interfaces (including pelrmagick) would have duplicated these actions.

More than likely PerlMagick Distort() only takes the final size numbers. only. I have no idea how 'resize geometry' handling should be done in perlmagick, as I am not involved in that API (or others).

I have no idea how a resize geometry should be added to the PerlMagick Distort() function, though I can see that it would be a useful addition.



Inputs other than simple 'array of floats' is likely to become more common, as this is a major sticking point for future Distorts(). Having CLI handle that, is a stop gap measure, as really it should be a dedicated 'string/file to distort input' type function, as an alternative method of argument specification.

For example a Grid distort could use an array of floats, but it is much more difficult to add a complex triangualition distort (for true image morphing), or 'sequence of local distorts' (see paper Interactive Image Warping) using such a limited input method.

Of course before that I need to add a whole new level of distortion handling into the main loop of the distort function, so I can process different areas of the image with different distorts, or distort coordinates multiple times before doing the lookup from the source.

Sorry I'm rambling. :)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply