1 2 3 4 5 <!DOCTYPE html> 6 <html lang="en"> 7 <head> 8 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 9 <title>ImageMagick: MagickCore, C API for ImageMagick: Transform an Image</title> 10 <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 11 <meta name="application-name" content="ImageMagick"/> 12 <meta name="description" content="ImageMagick is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bzier curves."/> 13 <meta name="application-url" content="http://www.imagemagick.org"/> 14 <meta name="generator" content="PHP"/> 15 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, 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-2016 ImageMagick Studio LLC"/> 23 <meta name="distribution" content="Global"/> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/> 25 <link rel="icon" href="../image/wand.png"/> 26 <link rel="shortcut icon" href="../image/wand.ico"/> 27 <link rel="stylesheet" href="../css/magick.php"/> 28 </head> 29 <body> 30 <div class="main"> 31 <div class="magick-masthead"> 32 <div class="container"> 33 <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 34 style="display:block" 35 data-ad-client="ca-pub-3129977114552745" 36 data-ad-slot="6345125851" 37 data-ad-format="auto"></ins> 38 <script> 39 (adsbygoogle = window.adsbygoogle || []).push({}); 40 </script> 41 <nav class="magick-nav"> 42 <a class="magick-nav-item " href="../index.php">Home</a> 43 <a class="magick-nav-item " href="../script/binary-releases.php">Download</a> 44 <a class="magick-nav-item " href="../script/command-line-tools.php">Tools</a> 45 <a class="magick-nav-item " href="../script/command-line-options.php">Options</a> 46 <a class="magick-nav-item " href="../script/resources.php">Resources</a> 47 <a class="magick-nav-item " href="../script/api.php">Develop</a> 48 <a class="magick-nav-item " href="../script/search.php">Search</a> 49 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a> 50 </nav> 51 </div> 52 </div> 53 <div class="container"> 54 <div class="magick-header"> 55 <p class="text-center"><a href="transform.php#AutoOrientImage">AutoOrientImage</a> • <a href="transform.php#ChopImage">ChopImage</a> • <a href="transform.php#CropImage">CropImage</a> • <a href="transform.php#CropImageToTiles">CropImageToTiles</a> • <a href="transform.php#ExcerptImage">ExcerptImage</a> • <a href="transform.php#ExtentImage">ExtentImage</a> • <a href="transform.php#FlipImage">FlipImage</a> • <a href="transform.php#FlopImage">FlopImage</a> • <a href="transform.php#RollImage">RollImage</a> • <a href="transform.php#ShaveImage">ShaveImage</a> • <a href="transform.php#SpliceImage">SpliceImage</a> • <a href="transform.php#TransformImage">TransformImage</a> • <a href="transform.php#TransformImages">TransformImages</a> • <a href="transform.php#TransposeImage">TransposeImage</a> • <a href="transform.php#TransverseImage">TransverseImage</a> • <a href="transform.php#TrimImage">TrimImage</a></p> 56 57 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="AutoOrientImage">AutoOrientImage</a></h2> 58 59 <p>AutoOrientImage() adjusts an image so that its orientation is suitable for viewing (i.e. top-left orientation).</p> 60 61 <p>The format of the AutoOrientImage method is:</p> 62 63 <pre class="text"> 64 Image *AutoOrientImage(const Image *image, 65 const OrientationType orientation,ExceptionInfo *exception) 66 </pre> 67 68 <p>A description of each parameter follows:</p> 69 70 <dd> 71 </dd> 72 73 <dd> </dd> 74 <dl class="dl-horizontal"> 75 <dt>image</dt> 76 <dd>The image. </dd> 77 78 <dd> </dd> 79 <dt>orientation</dt> 80 <dd>Current image orientation. </dd> 81 82 <dd> </dd> 83 <dt>exception</dt> 84 <dd>Return any errors or warnings in this structure. </dd> 85 86 <dd> </dd> 87 </dl> 88 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="ChopImage">ChopImage</a></h2> 89 90 <p>ChopImage() removes a region of an image and collapses the image to occupy the removed portion.</p> 91 92 <p>The format of the ChopImage method is:</p> 93 94 <pre class="text"> 95 Image *ChopImage(const Image *image,const RectangleInfo *chop_info) 96 ExceptionInfo *exception) 97 </pre> 98 99 <p>A description of each parameter follows:</p> 100 101 <dd> 102 </dd> 103 104 <dd> </dd> 105 <dl class="dl-horizontal"> 106 <dt>image</dt> 107 <dd>the image. </dd> 108 109 <dd> </dd> 110 <dt>chop_info</dt> 111 <dd>Define the region of the image to chop. </dd> 112 113 <dd> </dd> 114 <dt>exception</dt> 115 <dd>return any errors or warnings in this structure. </dd> 116 117 <dd> </dd> 118 </dl> 119 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="CropImage">CropImage</a></h2> 120 121 <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> 122 123 <p>The format of the CropImage method is:</p> 124 125 <pre class="text"> 126 Image *CropImage(const Image *image,const RectangleInfo *geometry, 127 ExceptionInfo *exception) 128 </pre> 129 130 <p>A description of each parameter follows:</p> 131 132 <dd> 133 </dd> 134 135 <dd> </dd> 136 <dl class="dl-horizontal"> 137 <dt>image</dt> 138 <dd>the image. </dd> 139 140 <dd> </dd> 141 <dt>geometry</dt> 142 <dd>Define the region of the image to crop with members x, y, width, and height. </dd> 143 144 <dd> </dd> 145 <dt>exception</dt> 146 <dd>return any errors or warnings in this structure. </dd> 147 148 <dd> </dd> 149 </dl> 150 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="CropImageToTiles">CropImageToTiles</a></h2> 151 152 <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> 153 154 <p>Image *CropImageToTiles(const Image *image, const RectangleInfo *crop_geometry, ExceptionInfo *exception)</p> 155 156 <p>A description of each parameter follows:</p> 157 158 <dd> 159 </dd> 160 161 <dd> </dd> 162 <dl class="dl-horizontal"> 163 <dt>image</dt> 164 <dd>the image The transformed image is returned as this parameter. </dd> 165 166 <dd> </dd> 167 <dt>crop_geometry</dt> 168 <dd>A crop geometry string. </dd> 169 170 <dd> </dd> 171 <dt>exception</dt> 172 <dd>return any errors or warnings in this structure. </dd> 173 174 <dd> </dd> 175 </dl> 176 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="ExcerptImage">ExcerptImage</a></h2> 177 178 <p>ExcerptImage() returns a excerpt of the image as defined by the geometry.</p> 179 180 <p>The format of the ExcerptImage method is:</p> 181 182 <pre class="text"> 183 Image *ExcerptImage(const Image *image,const RectangleInfo *geometry, 184 ExceptionInfo *exception) 185 </pre> 186 187 <p>A description of each parameter follows:</p> 188 189 <dd> 190 </dd> 191 192 <dd> </dd> 193 <dl class="dl-horizontal"> 194 <dt>image</dt> 195 <dd>the image. </dd> 196 197 <dd> </dd> 198 <dt>geometry</dt> 199 <dd>Define the region of the image to extend with members x, y, width, and height. </dd> 200 201 <dd> </dd> 202 <dt>exception</dt> 203 <dd>return any errors or warnings in this structure. </dd> 204 205 <dd> </dd> 206 </dl> 207 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="ExtentImage">ExtentImage</a></h2> 208 209 <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> 210 211 <p>The format of the ExtentImage method is:</p> 212 213 <pre class="text"> 214 Image *ExtentImage(const Image *image,const RectangleInfo *geometry, 215 ExceptionInfo *exception) 216 </pre> 217 218 <p>A description of each parameter follows:</p> 219 220 <dd> 221 </dd> 222 223 <dd> </dd> 224 <dl class="dl-horizontal"> 225 <dt>image</dt> 226 <dd>the image. </dd> 227 228 <dd> </dd> 229 <dt>geometry</dt> 230 <dd>Define the region of the image to extend with members x, y, width, and height. </dd> 231 232 <dd> </dd> 233 <dt>exception</dt> 234 <dd>return any errors or warnings in this structure. </dd> 235 236 <dd> </dd> 237 </dl> 238 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="FlipImage">FlipImage</a></h2> 239 240 <p>FlipImage() creates a vertical mirror image by reflecting the pixels around the central x-axis.</p> 241 242 <p>The format of the FlipImage method is:</p> 243 244 <pre class="text"> 245 Image *FlipImage(const Image *image,ExceptionInfo *exception) 246 </pre> 247 248 <p>A description of each parameter follows:</p> 249 250 <dd> 251 </dd> 252 253 <dd> </dd> 254 <dl class="dl-horizontal"> 255 <dt>image</dt> 256 <dd>the image. </dd> 257 258 <dd> </dd> 259 <dt>exception</dt> 260 <dd>return any errors or warnings in this structure. </dd> 261 262 <dd> </dd> 263 </dl> 264 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="FlopImage">FlopImage</a></h2> 265 266 <p>FlopImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis.</p> 267 268 <p>The format of the FlopImage method is:</p> 269 270 <pre class="text"> 271 Image *FlopImage(const Image *image,ExceptionInfo *exception) 272 </pre> 273 274 <p>A description of each parameter follows:</p> 275 276 <dd> 277 </dd> 278 279 <dd> </dd> 280 <dl class="dl-horizontal"> 281 <dt>image</dt> 282 <dd>the image. </dd> 283 284 <dd> </dd> 285 <dt>exception</dt> 286 <dd>return any errors or warnings in this structure. </dd> 287 288 <dd> </dd> 289 </dl> 290 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="RollImage">RollImage</a></h2> 291 292 <p>RollImage() offsets an image as defined by x_offset and y_offset.</p> 293 294 <p>The format of the RollImage method is:</p> 295 296 <pre class="text"> 297 Image *RollImage(const Image *image,const ssize_t x_offset, 298 const ssize_t y_offset,ExceptionInfo *exception) 299 </pre> 300 301 <p>A description of each parameter follows:</p> 302 303 <dd> 304 </dd> 305 306 <dd> </dd> 307 <dl class="dl-horizontal"> 308 <dt>image</dt> 309 <dd>the image. </dd> 310 311 <dd> </dd> 312 <dt>x_offset</dt> 313 <dd>the number of columns to roll in the horizontal direction. </dd> 314 315 <dd> </dd> 316 <dt>y_offset</dt> 317 <dd>the number of rows to roll in the vertical direction. </dd> 318 319 <dd> </dd> 320 <dt>exception</dt> 321 <dd>return any errors or warnings in this structure. </dd> 322 323 <dd> </dd> 324 </dl> 325 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="ShaveImage">ShaveImage</a></h2> 326 327 <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> 328 329 <p>The format of the ShaveImage method is:</p> 330 331 <pre class="text"> 332 Image *ShaveImage(const Image *image,const RectangleInfo *shave_info, 333 ExceptionInfo *exception) 334 </pre> 335 336 <p>A description of each parameter follows:</p> 337 338 <dd> 339 </dd> 340 341 <dd> </dd> 342 <dl class="dl-horizontal"> 343 <dt>shave_image</dt> 344 <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> 345 346 <dd> </dd> 347 <dt>image</dt> 348 <dd>the image. </dd> 349 350 <dd> </dd> 351 <dt>shave_info</dt> 352 <dd>Specifies a pointer to a RectangleInfo which defines the region of the image to crop. </dd> 353 354 <dd> </dd> 355 <dt>exception</dt> 356 <dd>return any errors or warnings in this structure. </dd> 357 358 <dd> </dd> 359 </dl> 360 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="SpliceImage">SpliceImage</a></h2> 361 362 <p>SpliceImage() splices a solid color into the image as defined by the geometry.</p> 363 364 <p>The format of the SpliceImage method is:</p> 365 366 <pre class="text"> 367 Image *SpliceImage(const Image *image,const RectangleInfo *geometry, 368 ExceptionInfo *exception) 369 </pre> 370 371 <p>A description of each parameter follows:</p> 372 373 <dd> 374 </dd> 375 376 <dd> </dd> 377 <dl class="dl-horizontal"> 378 <dt>image</dt> 379 <dd>the image. </dd> 380 381 <dd> </dd> 382 <dt>geometry</dt> 383 <dd>Define the region of the image to splice with members x, y, width, and height. </dd> 384 385 <dd> </dd> 386 <dt>exception</dt> 387 <dd>return any errors or warnings in this structure. </dd> 388 389 <dd> </dd> 390 </dl> 391 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TransformImage">TransformImage</a></h2> 392 393 <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> 394 395 <p>This should only be used for single images.</p> 396 397 <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> 398 399 <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> 400 401 <p>This function and should probably be deprecated in favor of direct calls to CropImageToTiles() or ResizeImage(), as appropriate.</p> 402 403 <p>The format of the TransformImage method is:</p> 404 405 <pre class="text"> 406 MagickBooleanType TransformImage(Image **image,const char *crop_geometry, 407 const char *image_geometry,ExceptionInfo *exception) 408 </pre> 409 410 <p>A description of each parameter follows:</p> 411 412 <dd> 413 </dd> 414 415 <dd> </dd> 416 <dl class="dl-horizontal"> 417 <dt>image</dt> 418 <dd>the image The transformed image is returned as this parameter. </dd> 419 420 <dd> </dd> 421 <dt>crop_geometry</dt> 422 <dd>A crop geometry string. This geometry defines a subregion of the image to crop. </dd> 423 424 <dd> </dd> 425 <dt>image_geometry</dt> 426 <dd>An image geometry string. This geometry defines the final size of the image. </dd> 427 428 <dd> </dd> 429 <dt>exception</dt> 430 <dd>return any errors or warnings in this structure. </dd> 431 432 <dd> </dd> 433 </dl> 434 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TransformImages">TransformImages</a></h2> 435 436 <p>TransformImages() calls TransformImage() on each image of a sequence.</p> 437 438 <p>The format of the TransformImage method is:</p> 439 440 <pre class="text"> 441 MagickBooleanType TransformImages(Image **image, 442 const char *crop_geometry,const char *image_geometry, 443 ExceptionInfo *exception) 444 </pre> 445 446 <p>A description of each parameter follows:</p> 447 448 <dd> 449 </dd> 450 451 <dd> </dd> 452 <dl class="dl-horizontal"> 453 <dt>image</dt> 454 <dd>the image The transformed image is returned as this parameter. </dd> 455 456 <dd> </dd> 457 <dt>crop_geometry</dt> 458 <dd>A crop geometry string. This geometry defines a subregion of the image to crop. </dd> 459 460 <dd> </dd> 461 <dt>image_geometry</dt> 462 <dd>An image geometry string. This geometry defines the final size of the image. </dd> 463 464 <dd> </dd> 465 <dt>exception</dt> 466 <dd>return any errors or warnings in this structure. </dd> 467 468 <dd> </dd> 469 </dl> 470 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TransposeImage">TransposeImage</a></h2> 471 472 <p>TransposeImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them by 90 degrees.</p> 473 474 <p>The format of the TransposeImage method is:</p> 475 476 <pre class="text"> 477 Image *TransposeImage(const Image *image,ExceptionInfo *exception) 478 </pre> 479 480 <p>A description of each parameter follows:</p> 481 482 <dd> 483 </dd> 484 485 <dd> </dd> 486 <dl class="dl-horizontal"> 487 <dt>image</dt> 488 <dd>the image. </dd> 489 490 <dd> </dd> 491 <dt>exception</dt> 492 <dd>return any errors or warnings in this structure. </dd> 493 494 <dd> </dd> 495 </dl> 496 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TransverseImage">TransverseImage</a></h2> 497 498 <p>TransverseImage() creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them by 270 degrees.</p> 499 500 <p>The format of the TransverseImage method is:</p> 501 502 <pre class="text"> 503 Image *TransverseImage(const Image *image,ExceptionInfo *exception) 504 </pre> 505 506 <p>A description of each parameter follows:</p> 507 508 <dd> 509 </dd> 510 511 <dd> </dd> 512 <dl class="dl-horizontal"> 513 <dt>image</dt> 514 <dd>the image. </dd> 515 516 <dd> </dd> 517 <dt>exception</dt> 518 <dd>return any errors or warnings in this structure. </dd> 519 520 <dd> </dd> 521 </dl> 522 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TrimImage">TrimImage</a></h2> 523 524 <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> 525 526 <p>The format of the TrimImage method is:</p> 527 528 <pre class="text"> 529 Image *TrimImage(const Image *image,ExceptionInfo *exception) 530 </pre> 531 532 <p>A description of each parameter follows:</p> 533 534 <dd> 535 </dd> 536 537 <dd> </dd> 538 <dl class="dl-horizontal"> 539 <dt>image</dt> 540 <dd>the image. </dd> 541 542 <dd> </dd> 543 <dt>exception</dt> 544 <dd>return any errors or warnings in this structure. </dd> 545 546 <dd> </dd> 547 </dl> 548 </div> 549 <footer class="magick-footer"> 550 <p><a href="../script/support.php">Donate</a> 551 <a href="../script/sitemap.php">Sitemap</a> 552 <a href="../script/links.php">Related</a> 553 <a href="../script/architecture.php">Architecture</a> 554 </p> 555 <p><a href="transform.php#">Back to top</a> 556 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 557 <a href="../script/contact.php">Contact Us</a></p> 558 <p><small> 1999-2016 ImageMagick Studio LLC</small></p> 559 </footer> 560 </div><!-- /.container --> 561 562 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 563 <script src="http://nextgen.imagemagick.org/js/magick.php"></script> 564 </div> 565 </body> 566 </html> 567