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: Transform an Image @ 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:, transform, an, image, 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="transform.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="transform.html#AutoOrientImage">AutoOrientImage</a> • <a href="transform.html#ChopImage">ChopImage</a> • <a href="transform.html#CropImage">CropImage</a> • <a href="transform.html#CropImageToTiles">CropImageToTiles</a> • <a href="transform.html#ExcerptImage">ExcerptImage</a> • <a href="transform.html#ExtentImage">ExtentImage</a> • <a href="transform.html#FlipImage">FlipImage</a> • <a href="transform.html#FlopImage">FlopImage</a> • <a href="transform.html#RollImage">RollImage</a> • <a href="transform.html#ShaveImage">ShaveImage</a> • <a href="transform.html#SpliceImage">SpliceImage</a> • <a href="transform.html#TransformImage">TransformImage</a> • <a href="transform.html#TransposeImage">TransposeImage</a> • <a href="transform.html#TransverseImage">TransverseImage</a> • <a href="transform.html#TrimImage">TrimImage</a></p> 85 86<h2><a href="../../api/MagickCore/transform_8c.html" id="AutoOrientImage">AutoOrientImage</a></h2> 87 88<p>AutoOrientImage() adjusts an image so that its orientation is suitable for viewing (i.e. top-left orientation).</p> 89 90<p>The format of the AutoOrientImage method is:</p> 91 92<pre class="text"> 93Image *AutoOrientImage(const Image *image, 94 const OrientationType orientation,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>orientation</dt> 109<dd>Current image orientation. </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/transform_8c.html" id="ChopImage">ChopImage</a></h2> 118 119<p>ChopImage() removes a region of an image and collapses the image to occupy the removed portion.</p> 120 121<p>The format of the ChopImage method is:</p> 122 123<pre class="text"> 124Image *ChopImage(const Image *image,const RectangleInfo *chop_info) 125 ExceptionInfo *exception) 126</pre> 127 128<p>A description of each parameter follows:</p> 129 130<dd> 131</dd> 132 133<dd> </dd> 134<dl class="dl-horizontal"> 135<dt>image</dt> 136<dd>the image. </dd> 137 138<dd> </dd> 139<dt>chop_info</dt> 140<dd>Define the region of the image to chop. </dd> 141 142<dd> </dd> 143<dt>exception</dt> 144<dd>return any errors or warnings in this structure. </dd> 145 146<dd> </dd> 147</dl> 148<h2><a href="../../api/MagickCore/transform_8c.html" id="CropImage">CropImage</a></h2> 149 150<p>CropImage() extracts a region of the image starting at the offset defined by geometry. Region must be fully defined, and no special handling of geometry flags is performed.</p> 151 152<p>The format of the CropImage method is:</p> 153 154<pre class="text"> 155Image *CropImage(const Image *image,const RectangleInfo *geometry, 156 ExceptionInfo *exception) 157</pre> 158 159<p>A description of each parameter follows:</p> 160 161<dd> 162</dd> 163 164<dd> </dd> 165<dl class="dl-horizontal"> 166<dt>image</dt> 167<dd>the image. </dd> 168 169<dd> </dd> 170<dt>geometry</dt> 171<dd>Define the region of the image to crop with members x, y, width, and height. </dd> 172 173<dd> </dd> 174<dt>exception</dt> 175<dd>return any errors or warnings in this structure. </dd> 176 177<dd> </dd> 178</dl> 179<h2><a href="../../api/MagickCore/transform_8c.html" id="CropImageToTiles">CropImageToTiles</a></h2> 180 181<p>CropImageToTiles() crops a single image, into a possible list of tiles. This may include a single sub-region of the image. This basically applies all the normal geometry flags for Crop.</p> 182 183<p>Image *CropImageToTiles(const Image *image, const RectangleInfo *crop_geometry, ExceptionInfo *exception)</p> 184 185<p>A description of each parameter follows:</p> 186 187<dd> 188</dd> 189 190<dd> </dd> 191<dl class="dl-horizontal"> 192<dt>image</dt> 193<dd>the image The transformed image is returned as this parameter. </dd> 194 195<dd> </dd> 196<dt>crop_geometry</dt> 197<dd>A crop geometry string. </dd> 198 199<dd> </dd> 200<dt>exception</dt> 201<dd>return any errors or warnings in this structure. </dd> 202 203<dd> </dd> 204</dl> 205<h2><a href="../../api/MagickCore/transform_8c.html" id="ExcerptImage">ExcerptImage</a></h2> 206 207<p>ExcerptImage() returns a excerpt of the image as defined by the geometry.</p> 208 209<p>The format of the ExcerptImage method is:</p> 210 211<pre class="text"> 212Image *ExcerptImage(const Image *image,const RectangleInfo *geometry, 213 ExceptionInfo *exception) 214</pre> 215 216<p>A description of each parameter follows:</p> 217 218<dd> 219</dd> 220 221<dd> </dd> 222<dl class="dl-horizontal"> 223<dt>image</dt> 224<dd>the image. </dd> 225 226<dd> </dd> 227<dt>geometry</dt> 228<dd>Define the region of the image to extend with members x, y, width, and height. </dd> 229 230<dd> </dd> 231<dt>exception</dt> 232<dd>return any errors or warnings in this structure. </dd> 233 234<dd> </dd> 235</dl> 236<h2><a href="../../api/MagickCore/transform_8c.html" id="ExtentImage">ExtentImage</a></h2> 237 238<p>ExtentImage() extends the image as defined by the geometry, gravity, and image background color. Set the (x,y) offset of the geometry to move the original image relative to the extended image.</p> 239 240<p>The format of the ExtentImage method is:</p> 241 242<pre class="text"> 243Image *ExtentImage(const Image *image,const RectangleInfo *geometry, 244 ExceptionInfo *exception) 245</pre> 246 247<p>A description of each parameter follows:</p> 248 249<dd> 250</dd> 251 252<dd> </dd> 253<dl class="dl-horizontal"> 254<dt>image</dt> 255<dd>the image. </dd> 256 257<dd> </dd> 258<dt>geometry</dt> 259<dd>Define the region of the image to extend with members x, y, width, and height. </dd> 260 261<dd> </dd> 262<dt>exception</dt> 263<dd>return any errors or warnings in this structure. </dd> 264 265<dd> </dd> 266</dl> 267<h2><a href="../../api/MagickCore/transform_8c.html" id="FlipImage">FlipImage</a></h2> 268 269<p>FlipImage() creates a vertical mirror image by reflecting the pixels around the central x-axis.</p> 270 271<p>The format of the FlipImage method is:</p> 272 273<pre class="text"> 274Image *FlipImage(const Image *image,ExceptionInfo *exception) 275</pre> 276 277<p>A description of each parameter follows:</p> 278 279<dd> 280</dd> 281 282<dd> </dd> 283<dl class="dl-horizontal"> 284<dt>image</dt> 285<dd>the image. </dd> 286 287<dd> </dd> 288<dt>exception</dt> 289<dd>return any errors or warnings in this structure. </dd> 290 291<dd> </dd> 292</dl> 293<h2><a href="../../api/MagickCore/transform_8c.html" id="FlopImage">FlopImage</a></h2> 294 295<p>FlopImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis.</p> 296 297<p>The format of the FlopImage method is:</p> 298 299<pre class="text"> 300Image *FlopImage(const Image *image,ExceptionInfo *exception) 301</pre> 302 303<p>A description of each parameter follows:</p> 304 305<dd> 306</dd> 307 308<dd> </dd> 309<dl class="dl-horizontal"> 310<dt>image</dt> 311<dd>the image. </dd> 312 313<dd> </dd> 314<dt>exception</dt> 315<dd>return any errors or warnings in this structure. </dd> 316 317<dd> </dd> 318</dl> 319<h2><a href="../../api/MagickCore/transform_8c.html" id="RollImage">RollImage</a></h2> 320 321<p>RollImage() offsets an image as defined by x_offset and y_offset.</p> 322 323<p>The format of the RollImage method is:</p> 324 325<pre class="text"> 326Image *RollImage(const Image *image,const ssize_t x_offset, 327 const ssize_t y_offset,ExceptionInfo *exception) 328</pre> 329 330<p>A description of each parameter follows:</p> 331 332<dd> 333</dd> 334 335<dd> </dd> 336<dl class="dl-horizontal"> 337<dt>image</dt> 338<dd>the image. </dd> 339 340<dd> </dd> 341<dt>x_offset</dt> 342<dd>the number of columns to roll in the horizontal direction. </dd> 343 344<dd> </dd> 345<dt>y_offset</dt> 346<dd>the number of rows to roll in the vertical direction. </dd> 347 348<dd> </dd> 349<dt>exception</dt> 350<dd>return any errors or warnings in this structure. </dd> 351 352<dd> </dd> 353</dl> 354<h2><a href="../../api/MagickCore/transform_8c.html" id="ShaveImage">ShaveImage</a></h2> 355 356<p>ShaveImage() shaves pixels from the image edges. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.</p> 357 358<p>The format of the ShaveImage method is:</p> 359 360<pre class="text"> 361Image *ShaveImage(const Image *image,const RectangleInfo *shave_info, 362 ExceptionInfo *exception) 363</pre> 364 365<p>A description of each parameter follows:</p> 366 367<dd> 368</dd> 369 370<dd> </dd> 371<dl class="dl-horizontal"> 372<dt>shave_image</dt> 373<dd>Method ShaveImage returns a pointer to the shaved image. A null image is returned if there is a memory shortage or if the image width or height is zero. </dd> 374 375<dd> </dd> 376<dt>image</dt> 377<dd>the image. </dd> 378 379<dd> </dd> 380<dt>shave_info</dt> 381<dd>Specifies a pointer to a RectangleInfo which defines the region of the image to crop. </dd> 382 383<dd> </dd> 384<dt>exception</dt> 385<dd>return any errors or warnings in this structure. </dd> 386 387<dd> </dd> 388</dl> 389<h2><a href="../../api/MagickCore/transform_8c.html" id="SpliceImage">SpliceImage</a></h2> 390 391<p>SpliceImage() splices a solid color into the image as defined by the geometry.</p> 392 393<p>The format of the SpliceImage method is:</p> 394 395<pre class="text"> 396Image *SpliceImage(const Image *image,const RectangleInfo *geometry, 397 ExceptionInfo *exception) 398</pre> 399 400<p>A description of each parameter follows:</p> 401 402<dd> 403</dd> 404 405<dd> </dd> 406<dl class="dl-horizontal"> 407<dt>image</dt> 408<dd>the image. </dd> 409 410<dd> </dd> 411<dt>geometry</dt> 412<dd>Define the region of the image to splice with members x, y, width, and height. </dd> 413 414<dd> </dd> 415<dt>exception</dt> 416<dd>return any errors or warnings in this structure. </dd> 417 418<dd> </dd> 419</dl> 420<h2><a href="../../api/MagickCore/transform_8c.html" id="TransformImage">TransformImage</a></h2> 421 422<p>TransformImage() is a convenience method that behaves like ResizeImage() or CropImage() but accepts scaling and/or cropping information as a region geometry specification. If the operation fails, the original image handle is left as is.</p> 423 424<p>This should only be used for single images.</p> 425 426<p>This function destroys what it assumes to be a single image list. If the input image is part of a larger list, all other images in that list will be simply 'lost', not destroyed.</p> 427 428<p>Also if the crop generates a list of images only the first image is resized. And finally if the crop succeeds and the resize failed, you will get a cropped image, as well as a 'false' or 'failed' report.</p> 429 430<p>This function and should probably be deprecated in favor of direct calls to CropImageToTiles() or ResizeImage(), as appropriate.</p> 431 432<p>The format of the TransformImage method is:</p> 433 434<pre class="text"> 435MagickBooleanType TransformImage(Image **image,const char *crop_geometry, 436 const char *image_geometry,ExceptionInfo *exception) 437</pre> 438 439<p>A description of each parameter follows:</p> 440 441<dd> 442</dd> 443 444<dd> </dd> 445<dl class="dl-horizontal"> 446<dt>image</dt> 447<dd>the image The transformed image is returned as this parameter. </dd> 448 449<dd> </dd> 450<dt>crop_geometry</dt> 451<dd>A crop geometry string. This geometry defines a subregion of the image to crop. </dd> 452 453<dd> </dd> 454<dt>image_geometry</dt> 455<dd>An image geometry string. This geometry defines the final size of the image. </dd> 456 457<dd> </dd> 458<dt>exception</dt> 459<dd>return any errors or warnings in this structure. </dd> 460 461<dd> </dd> 462</dl> 463<h2><a href="../../api/MagickCore/transform_8c.html" id="TransposeImage">TransposeImage</a></h2> 464 465<p>TransposeImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them by 90 degrees.</p> 466 467<p>The format of the TransposeImage method is:</p> 468 469<pre class="text"> 470Image *TransposeImage(const Image *image,ExceptionInfo *exception) 471</pre> 472 473<p>A description of each parameter follows:</p> 474 475<dd> 476</dd> 477 478<dd> </dd> 479<dl class="dl-horizontal"> 480<dt>image</dt> 481<dd>the image. </dd> 482 483<dd> </dd> 484<dt>exception</dt> 485<dd>return any errors or warnings in this structure. </dd> 486 487<dd> </dd> 488</dl> 489<h2><a href="../../api/MagickCore/transform_8c.html" id="TransverseImage">TransverseImage</a></h2> 490 491<p>TransverseImage() creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them by 270 degrees.</p> 492 493<p>The format of the TransverseImage method is:</p> 494 495<pre class="text"> 496Image *TransverseImage(const Image *image,ExceptionInfo *exception) 497</pre> 498 499<p>A description of each parameter follows:</p> 500 501<dd> 502</dd> 503 504<dd> </dd> 505<dl class="dl-horizontal"> 506<dt>image</dt> 507<dd>the image. </dd> 508 509<dd> </dd> 510<dt>exception</dt> 511<dd>return any errors or warnings in this structure. </dd> 512 513<dd> </dd> 514</dl> 515<h2><a href="../../api/MagickCore/transform_8c.html" id="TrimImage">TrimImage</a></h2> 516 517<p>TrimImage() trims pixels from the image edges. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.</p> 518 519<p>The format of the TrimImage method is:</p> 520 521<pre class="text"> 522Image *TrimImage(const Image *image,ExceptionInfo *exception) 523</pre> 524 525<p>A description of each parameter follows:</p> 526 527<dd> 528</dd> 529 530<dd> </dd> 531<dl class="dl-horizontal"> 532<dt>image</dt> 533<dd>the image. </dd> 534 535<dd> </dd> 536<dt>exception</dt> 537<dd>return any errors or warnings in this structure. </dd> 538 539<dd> </dd> 540</dl> 541</div> 542 </div> 543 </main><!-- /.container --> 544 <footer class="magick-footer"> 545 <p><a href="../../www/security-policy.html">Security</a> • 546 <a href="../../www/architecture.html">Architecture</a> • 547 <a href="../../www/links.html">Related</a> • 548 <a href="../../www/sitemap.html">Sitemap</a> 549 550 <a href="transform.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../images/wand.ico"/></a> 551 552 <a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • 553 <a href="../../www/support.html">Donate</a> • 554 <a href="../../www/contact.html">Contact Us</a> 555 <br/> 556 <small>© 1999-2019 ImageMagick Studio LLC</small></p> 557 </footer> 558 559 <!-- Javascript assets --> 560 <script src="../assets/magick.js" crossorigin="anonymous"></script> 561 <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.3.1/jquery.min.js"><\/script>')</script> 562</body> 563</html> 564<!-- Magick Cache 3rd January 2019 20:56 -->