parameters and relative positioning in distort

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

parameters and relative positioning in distort

Post by javismiles »

hi my friends
in a command that uses ' -matte -virtual-pixel transparent -distort Perspective'
within a larger canvas

i dont understand well how the point numbers work, they seem to behave in a peculiar way,
if i understand well, those numbers map how each of the 4 corners of the picture move, where they move,
which would also control the positioning, is that correct? however i see that depending on the relative size of the picture im trying to distort , in relation
to the larger canvas, very different results happen, how does it relate the size of the picture im trying to distort to the size of the canvas where it is composed on?
this is confusing me
thank u very much
jav
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: parameters and relative positioning in distort

Post by fmw42 »

try +distort to make the output the full size of the distorted image rather than just the input image size.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: parameters and relative positioning in distort

Post by anthony »

The 4 control point mapping between source and destination image can be ANY non-linear set of points.

-distort however will use the same 'viewport' as the input source image. That is the resulting image will be the same size and position as the source image in the distorted space. (the exception is polar distorts as the spaces are just too different to match up).

+distort tries to create a layer image (with virtual canvas offset) that best matches the size and location of the whole source image (if posible) Some distorts however (like shepards) can not be reversed (of the reverse mapping used, so really a forward mapping) so can figure out such a 'best fit' image.

BOTH however will accept a special 'viewport' expert argument
http://www.imagemagick.org/Usage/distor ... t_viewport
which defines the 'layer image with virtual offset' of the distorted space to use. This can look at any part of the distorted space regardless of where the input image or control points gets mapped to. It basically overrides the default two viewport methods.

Another expert option
http://www.imagemagick.org/Usage/distor ... tort_scale
will multiply the distort viewport image (whatever its source) so it still views the same 'viewport' but increases the number of samples (pixels) in the resulting image. Typically this will be an integer (to provide super sampling) but can actually be a floating point value.

I hope that clears up things.

If not READ IM EXAMPLES from the start of the page, so you understand the distort process completely.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply