1 2 3 4 5<!DOCTYPE html> 6<html lang="en"> 7<head> 8 <meta charset="utf-8" /> 9 <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no" /> 10 <title>MagickCore, C API: Image Distortions @ ImageMagick</title> 11 <meta name="application-name" content="ImageMagick" /> 12 <meta name="description" content="Use ImageMagick® to create, edit, compose, or convert bitmap images. You can resize your image, crop it, change its shades and colors, add captions, among other operations." /> 13 <meta name="application-url" content="https://imagemagick.org" /> 14 <meta name="generator" content="PHP" /> 15 <meta name="keywords" content="magickcore, c, api:, image, distortions, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert" /> 16 <meta name="rating" content="GENERAL" /> 17 <meta name="robots" content="INDEX, FOLLOW" /> 18 <meta name="generator" content="ImageMagick Studio LLC" /> 19 <meta name="author" content="ImageMagick Studio LLC" /> 20 <meta name="revisit-after" content="2 DAYS" /> 21 <meta name="resource-type" content="document" /> 22 <meta name="copyright" content="Copyright (c) 1999-2019 ImageMagick Studio LLC" /> 23 <meta name="distribution" content="Global" /> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" /> 25 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 26 <link href="distort.html" rel="canonical" /> 27 <link href="../../images/wand.png" rel="icon" /> 28 <link href="../../images/wand.ico" rel="shortcut icon" /> 29 <link href="../assets/magick.css" rel="stylesheet" /> 30</head> 31<body> 32 <header> 33 <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> 34 <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../images/wand.ico"/></a> 35 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation"> 36 <span class="navbar-toggler-icon"></span> 37 </button> 38 39 <div class="navbar-collapse collapse" id="navbarsMagick" style=""> 40 <ul class="navbar-nav mr-auto"> 41 <li class="nav-item "> 42 <a class="nav-link" href="quantize.html">Home <span class="sr-only">(current)</span></a> 43 </li> 44 <li class="nav-item "> 45 <a class="nav-link" href="../../www/download.html">Download</a> 46 </li> 47 <li class="nav-item "> 48 <a class="nav-link" href="../../www/command-line-tools.html">Tools</a> 49 </li> 50 <li class="nav-item "> 51 <a class="nav-link" href="../../www/command-line-processing.html">Command-line</a> 52 </li> 53 <li class="nav-item "> 54 <a class="nav-link" href="../../www/resources.html">Resources</a> 55 </li> 56 <li class="nav-item "> 57 <a class="nav-link" href="../../www/develop.html">Develop</a> 58 </li> 59 <li class="nav-item"> 60 <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a> 61 </li> 62 </ul> 63 <form class="form-inline my-2 my-lg-0" action="https://imagemagick.org/script/search.php"> 64 <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search"> 65 <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button> 66 </form> 67 </div> 68 </nav> 69 <div class="container"> 70 <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 71 style="display:block" 72 data-ad-client="ca-pub-3129977114552745" 73 data-ad-slot="6345125851" 74 data-ad-format="auto"></ins> 75 <script> 76 (adsbygoogle = window.adsbygoogle || []).push({}); 77 </script> 78 79 </div> 80 </header> 81 <main class="container"> 82 <div class="magick-template"> 83<div class="magick-header"> 84<p class="text-center"><a href="distort.html#AffineTransformImage">AffineTransformImage</a> • <a href="distort.html#DistortImage">DistortImage</a> • <a href="distort.html#RotateImage">RotateImage</a> • <a href="distort.html#SparseColorImage">SparseColorImage</a></p> 85 86<h2><a href="../../api/MagickCore/distort_8c.html" id="AffineTransformImage">AffineTransformImage</a></h2> 87 88<p>AffineTransformImage() transforms an image as dictated by the affine matrix. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.</p> 89 90<p>The format of the AffineTransformImage method is:</p> 91 92<pre class="text"> 93Image *AffineTransformImage(const Image *image, 94 AffineMatrix *affine_matrix,ExceptionInfo *exception) 95</pre> 96 97<p>A description of each parameter follows:</p> 98 99<dd> 100</dd> 101 102<dd> </dd> 103<dl class="dl-horizontal"> 104<dt>image</dt> 105<dd>the image. </dd> 106 107<dd> </dd> 108<dt>affine_matrix</dt> 109<dd>the affine matrix. </dd> 110 111<dd> </dd> 112<dt>exception</dt> 113<dd>return any errors or warnings in this structure. </dd> 114 115<dd> </dd> 116</dl> 117<h2><a href="../../api/MagickCore/distort_8c.html" id="DistortImage">DistortImage</a></h2> 118 119<p>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.</p> 120 121<p>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.</p> 122 123<p>If the '-verbose' control option has been set print to standard error the equicelent '-fx' formula with coefficients for the function, if practical.</p> 124 125<p>The format of the DistortImage() method is:</p> 126 127<pre class="text"> 128Image *DistortImage(const Image *image,const DistortMethod method, 129 const size_t number_arguments,const double *arguments, 130 MagickBooleanType bestfit, ExceptionInfo *exception) 131</pre> 132 133<p>A description of each parameter follows:</p> 134 135<dd> 136</dd> 137 138<dd> </dd> 139<dl class="dl-horizontal"> 140<dt>image</dt> 141<dd>the image to be distorted. </dd> 142 143<dd> </dd> 144<dt>method</dt> 145<dd>the method of image distortion. </dd> 146 147<dd> ArcDistortion always ignores source image offset, and always 'bestfit' the destination image with the top left corner offset relative to the polar mapping center. </dd> 148 149<dd> Affine, Perspective, and Bilinear, do least squares fitting of the distrotion when more than the minimum number of control point pairs are provided. </dd> 150 151<dd> 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. </dd> 152 153<dd> </dd> 154<dt>number_arguments</dt> 155<dd>the number of arguments given. </dd> 156 157<dd> </dd> 158<dt>arguments</dt> 159<dd>an array of floating point arguments for this method. </dd> 160 161<dd> </dd> 162<dt>bestfit</dt> 163<dd>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. </dd> 164 165<dd> </dd> 166<dt>exception</dt> 167<dd>return any errors or warnings in this structure </dd> 168 169<dd> Extra Controls from Image meta-data (artifacts)... </dd> 170 171<dd> o "verbose" Output to stderr alternatives, internal coefficents, and FX equivalents for the distortion operation (if feasible). This forms an extra check of the distortion method, and allows users access to the internal constants IM calculates for the distortion. </dd> 172 173<dd> o "distort:viewport" Directly set the output image canvas area and offest to use for the resulting image, rather than use the original images canvas, or a calculated 'bestfit' canvas. </dd> 174 175<dd> o "distort:scale" Scale the size of the output canvas by this amount to provide a method of Zooming, and for super-sampling the results. </dd> 176 177<dd> Other settings that can effect results include </dd> 178 179<dd> o 'interpolate' For source image lookups (scale enlargements) </dd> 180 181<dd> o 'filter' Set filter to use for area-resampling (scale shrinking). Set to 'point' to turn off and use 'interpolate' lookup instead </dd> 182 183<dd> </dd> 184</dl> 185<h2><a href="../../api/MagickCore/distort_8c.html" id="RotateImage">RotateImage</a></h2> 186 187<p>RotateImage() creates a new image that is a rotated copy of an existing one. Positive angles rotate counter-clockwise (right-hand rule), while negative angles rotate clockwise. Rotated images are usually larger than the originals and have 'empty' triangular corners. X axis. Empty triangles left over from shearing the image are filled with the background color defined by member 'background_color' of the image. RotateImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.</p> 188 189<p>The format of the RotateImage method is:</p> 190 191<pre class="text"> 192Image *RotateImage(const Image *image,const double degrees, 193 ExceptionInfo *exception) 194</pre> 195 196<p>A description of each parameter follows.</p> 197 198<dt>image</dt> 199<p>the image.</p> 200 201<dt>degrees</dt> 202<p>Specifies the number of degrees to rotate the image.</p> 203 204<dt>exception</dt> 205<p>return any errors or warnings in this structure.</p> 206 207<h2><a href="../../api/MagickCore/distort_8c.html" id="SparseColorImage">SparseColorImage</a></h2> 208 209<p>SparseColorImage(), given a set of coordinates, interpolates the colors found at those coordinates, across the whole image, using various methods.</p> 210 211<p>The format of the SparseColorImage() method is:</p> 212 213<pre class="text"> 214Image *SparseColorImage(const Image *image, 215 const SparseColorMethod method,const size_t number_arguments, 216 const double *arguments,ExceptionInfo *exception) 217</pre> 218 219<p>A description of each parameter follows:</p> 220 221<dd> 222</dd> 223 224<dd> </dd> 225<dl class="dl-horizontal"> 226<dt>image</dt> 227<dd>the image to be filled in. </dd> 228 229<dd> </dd> 230<dt>method</dt> 231<dd>the method to fill in the gradient between the control points. </dd> 232 233<dd> 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). </dd> 234 235<dd> </dd> 236<dt>number_arguments</dt> 237<dd>the number of arguments given. </dd> 238 239<dd> </dd> 240<dt>arguments</dt> 241<dd>array of floating point arguments for this method-- x,y,color_values-- with color_values given as normalized values. </dd> 242 243<dd> </dd> 244<dt>exception</dt> 245<dd>return any errors or warnings in this structure </dd> 246 247<dd> </dd> 248</dl> 249</div> 250 </div> 251 </main><!-- /.container --> 252 <footer class="magick-footer"> 253 <p><a href="../../www/security-policy.html">Security</a> • 254 <a href="../../www/architecture.html">Architecture</a> • 255 <a href="../../www/links.html">Related</a> • 256 <a href="../../www/sitemap.html">Sitemap</a> 257 258 <a href="distort.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../images/wand.ico"/></a> 259 260 <a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • 261 <a href="../../www/support.html">Donate</a> • 262 <a href="../../www/contact.html">Contact Us</a> 263 <br/> 264 <small>© 1999-2019 ImageMagick Studio LLC</small></p> 265 </footer> 266 267 <!-- Javascript assets --> 268 <script src="../assets/magick.js" crossorigin="anonymous"></script> 269 <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.3.1/jquery.min.js"><\/script>')</script> 270</body> 271</html> 272<!-- Magick Cache 4th January 2019 05:48 -->