[ImageMagick] [sponsor]

DistortImage

DistortImage() distorts an image using various distortion methods, by mapping color lookups of the source image to a new destination image usally of the same size as the source image, unless 'bestfit' is set to true.

If 'bestfit' is enabled, and distortion allows it, the destination image is adjusted to ensure the whole source 'image' will just fit within the final destination image, which will be sized and offset accordingly. Also in many cases the virtual offset of the source image will be taken into account in the mapping.

If the '-verbose' control option has been set print to standard error the equicelent '-fx' formula with coefficients for the function, if practical.

The format of the DistortImage() method is:

  Image *DistortImage(const Image *image,const DistortImageMethod method,
    const unsigned long number_arguments,const double *arguments,
    MagickBooleanType bestfit, ExceptionInfo *exception)

A description of each parameter follows:

image

    the image to be distorted.

method

    the method of image distortion.

ArcDistortion always ignores source image offset, and always 'bestfit' the destination image with the top left corner offset relative to the polar mapping center.

Bilinear has no simple inverse mapping so it does not allow 'bestfit' style of image distortion.

Affine, Perspective, and Bilinear, do least squares fitting of the distrotion when more than the minimum number of control point pairs are provided.

Perspective, and Bilinear, fall back to a Affine distortion when less than 4 control point pairs are provided. While Affine distortions let you use any number of control point pairs, that is Zero pairs is a No-Op (viewport only) distortion, one pair is a translation and two pairs of control points do a scale-rotate-translate, without any shearing.

number_arguments

    the number of arguments given.

arguments

    an array of floating point arguments for this method.

bestfit

    Attempt to 'bestfit' the size of the resulting image. This also forces the resulting image to be a 'layered' virtual canvas image. Can be overridden using 'distort:viewport' setting.

exception

    return any errors or warnings in this structure

SparseColorImage

SparseColorImage(), given a set of coordinates, interpolates the colors found at those coordinates, across the whole image, using various methods.

The format of the SparseColorImage() method is:

  Image *SparseColorImage(const Image *image,const ChannelType channel,
    SparseColorMethod method,const unsigned long number_arguments,
    const double *arguments,ExceptionInfo *exception)

A description of each parameter follows:

image

    the image to be filled in.

channel

    Specify which color values (in RGBKA sequence) are being set. This also determines the number of color_values in above.

method

    the method to fill in the gradient between the control points.

The methods used for SparseColor() are often simular to methods used for DistortImage(), and even share the same code for determination of the function coefficents, though with more dimensions (or resulting values).

number_arguments

    the number of arguments given.

arguments

    array of floating point arguments for this method-- x,y,color_values-- with color_values given as normalized values.

exception

    return any errors or warnings in this structure

 

a