ImageMagick: MagickCore, C API for ImageMagick: Image Distortions
Author: ImageMagick Studio LLC
Description: ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (about 100) including GIF, JPEG, JPEG-2000, PNG, PDF, PhotoCD, TIFF, and DPX. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you can freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems. The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite programming language. Choose from these interfaces: MagickCore (C), MagickWand (C), ChMagick (Ch), Magick++ (C++), JMagick (Java), L-Magick (Lisp), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (P [cell cut: 1167 characters, first 1000 kept]
Keywords: magickcore, c, api, for, imagemagick:, image, distortions, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject

## 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. ##### 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 Specific Distortion notes... ArcDistortion will always ignore 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 will not allow 'bestfit' style of image distortion. Affine, Perspective, and Bilinear, will do least squares fitting of the distrotion when more than the minimum number of control point pairs are provided. Perspective, and Bilinear, will fall back to a Affine distortion when less that 4 control point pairs are provided. While Affine distortions will let you use any number of control point pairs, that is Zero pairs is a No-Op (viewport only) distrotion, one pair is a translation and two pairs of control points will do a scale-rotate-translate, without any shearing. ## 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 SparseColor() method is:
      Image *SparseColor(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. ##### 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 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). |

Discourse Server • Mailing Lists • Cafe • Studio