• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>ImageMagick - MagickCore, C API: Transform an Image</title>
11  <meta name="application-name" content="ImageMagick" />
12  <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more." />
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-2020 ImageMagick Studio LLC" />
23  <meta name="distribution" content="Global" />
24  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
25  <meta property='og:url' content='../../' />
26  <meta property='og:title' content='ImageMagick' />
27  <meta property='og:image' content='../../images/logo.png' />
28  <meta property='og:type' content='website' />
29  <meta property='og:site_name' content='ImageMagick' />
30  <meta property='og:description' content="Convert, Edit, or Compose Bitmap Images" />
31  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
32  <link href="../www/api/transform.html" rel="canonical" />
33  <link href="../../www/images/wand.png" rel="icon" />
34  <link href="../../www/images/wand.ico" rel="shortcut icon" />
35  <link href="../../www/assets/magick.css" rel="stylesheet" />
36</head>
37<body>
38  <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
39    <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../www/images/wand.ico"/></a>
40    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation">
41      <span class="navbar-toggler-icon"></span>
42    </button>
43
44    <div class="navbar-collapse collapse" id="navbarsMagick" style="">
45    <ul class="navbar-nav mr-auto">
46      <li class="nav-item ">
47        <a class="nav-link" href="../../www/">Home <span class="sr-only">(current)</span></a>
48      </li>
49      <li class="nav-item ">
50        <a class="nav-link" href="../../www/www/download.html">Download</a>
51      </li>
52      <li class="nav-item ">
53        <a class="nav-link" href="../../www/www/command-line-tools.html">Tools</a>
54      </li>
55      <li class="nav-item ">
56        <a class="nav-link" href="../../www/www/command-line-processing.html">Command-line</a>
57      </li>
58      <li class="nav-item ">
59        <a class="nav-link" href="../../www/www/resources.html">Resources</a>
60      </li>
61      <li class="nav-item ">
62        <a class="nav-link" href="../../www/www/develop.html">Develop</a>
63      </li>
64      <li class="nav-item">
65        <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a>
66      </li>
67    </ul>
68    <form class="form-inline my-2 my-lg-0" action="../../www/www/search.html">
69      <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search">
70      <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button>
71    </form>
72    </div>
73  </nav>
74  <div class="container">
75   <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
76         style="display:block"
77         data-ad-client="ca-pub-3129977114552745"
78         data-ad-slot="6345125851"
79         data-full-width-responsive="true"
80         data-ad-format="horizontal"></ins>
81    <script>
82      (adsbygoogle = window.adsbygoogle || []).push({});
83    </script>
84
85  </div>
86
87  <main class="container">
88    <div class="magick-template">
89<div class="magick-header">
90<p class="text-center"><a href="transform.html#AutoOrientImage">AutoOrientImage</a> &#8226; <a href="transform.html#ChopImage">ChopImage</a> &#8226; <a href="transform.html#CropImage">CropImage</a> &#8226; <a href="transform.html#CropImageToTiles">CropImageToTiles</a> &#8226; <a href="transform.html#ExcerptImage">ExcerptImage</a> &#8226; <a href="transform.html#ExtentImage">ExtentImage</a> &#8226; <a href="transform.html#FlipImage">FlipImage</a> &#8226; <a href="transform.html#FlopImage">FlopImage</a> &#8226; <a href="transform.html#RollImage">RollImage</a> &#8226; <a href="transform.html#ShaveImage">ShaveImage</a> &#8226; <a href="transform.html#SpliceImage">SpliceImage</a> &#8226; <a href="transform.html#TransformImage">TransformImage</a> &#8226; <a href="transform.html#TransposeImage">TransposeImage</a> &#8226; <a href="transform.html#TransverseImage">TransverseImage</a> &#8226; <a href="transform.html#TrimImage">TrimImage</a></p>
91
92<h2><a href="../../api/MagickCore/transform_8c.html" id="AutoOrientImage">AutoOrientImage</a></h2>
93
94<p>AutoOrientImage() adjusts an image so that its orientation is suitable for viewing (i.e. top-left orientation).</p>
95
96<p>The format of the AutoOrientImage method is:</p>
97
98<pre class="text">
99Image *AutoOrientImage(const Image *image,
100  const OrientationType orientation,ExceptionInfo *exception)
101</pre>
102
103<p>A description of each parameter follows:</p>
104
105<dd>
106</dd>
107
108<dd> </dd>
109<dl class="dl-horizontal">
110<dt>image</dt>
111<dd>The image. </dd>
112
113<dd> </dd>
114<dt>orientation</dt>
115<dd>Current image orientation. </dd>
116
117<dd> </dd>
118<dt>exception</dt>
119<dd>Return any errors or warnings in this structure. </dd>
120
121<dd>  </dd>
122</dl>
123<h2><a href="../../api/MagickCore/transform_8c.html" id="ChopImage">ChopImage</a></h2>
124
125<p>ChopImage() removes a region of an image and collapses the image to occupy the removed portion.</p>
126
127<p>The format of the ChopImage method is:</p>
128
129<pre class="text">
130Image *ChopImage(const Image *image,const RectangleInfo *chop_info)
131  ExceptionInfo *exception)
132</pre>
133
134<p>A description of each parameter follows:</p>
135
136<dd>
137</dd>
138
139<dd> </dd>
140<dl class="dl-horizontal">
141<dt>image</dt>
142<dd>the image. </dd>
143
144<dd> </dd>
145<dt>chop_info</dt>
146<dd>Define the region of the image to chop. </dd>
147
148<dd> </dd>
149<dt>exception</dt>
150<dd>return any errors or warnings in this structure. </dd>
151
152<dd>  </dd>
153</dl>
154<h2><a href="../../api/MagickCore/transform_8c.html" id="CropImage">CropImage</a></h2>
155
156<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>
157
158<p>The format of the CropImage method is:</p>
159
160<pre class="text">
161Image *CropImage(const Image *image,const RectangleInfo *geometry,
162  ExceptionInfo *exception)
163</pre>
164
165<p>A description of each parameter follows:</p>
166
167<dd>
168</dd>
169
170<dd> </dd>
171<dl class="dl-horizontal">
172<dt>image</dt>
173<dd>the image. </dd>
174
175<dd> </dd>
176<dt>geometry</dt>
177<dd>Define the region of the image to crop with members x, y, width, and height. </dd>
178
179<dd> </dd>
180<dt>exception</dt>
181<dd>return any errors or warnings in this structure. </dd>
182
183<dd>  </dd>
184</dl>
185<h2><a href="../../api/MagickCore/transform_8c.html" id="CropImageToTiles">CropImageToTiles</a></h2>
186
187<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>
188
189<p>Image *CropImageToTiles(const Image *image, const RectangleInfo *crop_geometry, ExceptionInfo *exception)</p>
190
191<p>A description of each parameter follows:</p>
192
193<dd>
194</dd>
195
196<dd> </dd>
197<dl class="dl-horizontal">
198<dt>image</dt>
199<dd>the image The transformed image is returned as this parameter. </dd>
200
201<dd> </dd>
202<dt>crop_geometry</dt>
203<dd>A crop geometry string. </dd>
204
205<dd> </dd>
206<dt>exception</dt>
207<dd>return any errors or warnings in this structure. </dd>
208
209<dd>  </dd>
210</dl>
211<h2><a href="../../api/MagickCore/transform_8c.html" id="ExcerptImage">ExcerptImage</a></h2>
212
213<p>ExcerptImage() returns a excerpt of the image as defined by the geometry.</p>
214
215<p>The format of the ExcerptImage method is:</p>
216
217<pre class="text">
218Image *ExcerptImage(const Image *image,const RectangleInfo *geometry,
219  ExceptionInfo *exception)
220</pre>
221
222<p>A description of each parameter follows:</p>
223
224<dd>
225</dd>
226
227<dd> </dd>
228<dl class="dl-horizontal">
229<dt>image</dt>
230<dd>the image. </dd>
231
232<dd> </dd>
233<dt>geometry</dt>
234<dd>Define the region of the image to extend with members x, y, width, and height. </dd>
235
236<dd> </dd>
237<dt>exception</dt>
238<dd>return any errors or warnings in this structure. </dd>
239
240<dd>  </dd>
241</dl>
242<h2><a href="../../api/MagickCore/transform_8c.html" id="ExtentImage">ExtentImage</a></h2>
243
244<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>
245
246<p>The format of the ExtentImage method is:</p>
247
248<pre class="text">
249Image *ExtentImage(const Image *image,const RectangleInfo *geometry,
250  ExceptionInfo *exception)
251</pre>
252
253<p>A description of each parameter follows:</p>
254
255<dd>
256</dd>
257
258<dd> </dd>
259<dl class="dl-horizontal">
260<dt>image</dt>
261<dd>the image. </dd>
262
263<dd> </dd>
264<dt>geometry</dt>
265<dd>Define the region of the image to extend with members x, y, width, and height. </dd>
266
267<dd> </dd>
268<dt>exception</dt>
269<dd>return any errors or warnings in this structure. </dd>
270
271<dd>  </dd>
272</dl>
273<h2><a href="../../api/MagickCore/transform_8c.html" id="FlipImage">FlipImage</a></h2>
274
275<p>FlipImage() creates a vertical mirror image by reflecting the pixels around the central x-axis.</p>
276
277<p>The format of the FlipImage method is:</p>
278
279<pre class="text">
280Image *FlipImage(const Image *image,ExceptionInfo *exception)
281</pre>
282
283<p>A description of each parameter follows:</p>
284
285<dd>
286</dd>
287
288<dd> </dd>
289<dl class="dl-horizontal">
290<dt>image</dt>
291<dd>the image. </dd>
292
293<dd> </dd>
294<dt>exception</dt>
295<dd>return any errors or warnings in this structure. </dd>
296
297<dd>  </dd>
298</dl>
299<h2><a href="../../api/MagickCore/transform_8c.html" id="FlopImage">FlopImage</a></h2>
300
301<p>FlopImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis.</p>
302
303<p>The format of the FlopImage method is:</p>
304
305<pre class="text">
306Image *FlopImage(const Image *image,ExceptionInfo *exception)
307</pre>
308
309<p>A description of each parameter follows:</p>
310
311<dd>
312</dd>
313
314<dd> </dd>
315<dl class="dl-horizontal">
316<dt>image</dt>
317<dd>the image. </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="../../api/MagickCore/transform_8c.html" id="RollImage">RollImage</a></h2>
326
327<p>RollImage() offsets an image as defined by x_offset and y_offset.</p>
328
329<p>The format of the RollImage method is:</p>
330
331<pre class="text">
332Image *RollImage(const Image *image,const ssize_t x_offset,
333  const ssize_t y_offset,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>image</dt>
344<dd>the image. </dd>
345
346<dd> </dd>
347<dt>x_offset</dt>
348<dd>the number of columns to roll in the horizontal direction. </dd>
349
350<dd> </dd>
351<dt>y_offset</dt>
352<dd>the number of rows to roll in the vertical direction. </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="../../api/MagickCore/transform_8c.html" id="ShaveImage">ShaveImage</a></h2>
361
362<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>
363
364<p>The format of the ShaveImage method is:</p>
365
366<pre class="text">
367Image *ShaveImage(const Image *image,const RectangleInfo *shave_info,
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>shave_image</dt>
379<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>
380
381<dd> </dd>
382<dt>image</dt>
383<dd>the image. </dd>
384
385<dd> </dd>
386<dt>shave_info</dt>
387<dd>Specifies a pointer to a RectangleInfo which defines the region of the image to crop. </dd>
388
389<dd> </dd>
390<dt>exception</dt>
391<dd>return any errors or warnings in this structure. </dd>
392
393<dd>  </dd>
394</dl>
395<h2><a href="../../api/MagickCore/transform_8c.html" id="SpliceImage">SpliceImage</a></h2>
396
397<p>SpliceImage() splices a solid color into the image as defined by the geometry.</p>
398
399<p>The format of the SpliceImage method is:</p>
400
401<pre class="text">
402Image *SpliceImage(const Image *image,const RectangleInfo *geometry,
403  ExceptionInfo *exception)
404</pre>
405
406<p>A description of each parameter follows:</p>
407
408<dd>
409</dd>
410
411<dd> </dd>
412<dl class="dl-horizontal">
413<dt>image</dt>
414<dd>the image. </dd>
415
416<dd> </dd>
417<dt>geometry</dt>
418<dd>Define the region of the image to splice with members x, y, width, and height. </dd>
419
420<dd> </dd>
421<dt>exception</dt>
422<dd>return any errors or warnings in this structure. </dd>
423
424<dd>  </dd>
425</dl>
426<h2><a href="../../api/MagickCore/transform_8c.html" id="TransformImage">TransformImage</a></h2>
427
428<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>
429
430<p>This should only be used for single images.</p>
431
432<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>
433
434<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>
435
436<p>This function and should probably be deprecated in favor of direct calls to CropImageToTiles() or ResizeImage(), as appropriate.</p>
437
438<p>The format of the TransformImage method is:</p>
439
440<pre class="text">
441MagickBooleanType TransformImage(Image **image,const char *crop_geometry,
442  const char *image_geometry,ExceptionInfo *exception)
443</pre>
444
445<p>A description of each parameter follows:</p>
446
447<dd>
448</dd>
449
450<dd> </dd>
451<dl class="dl-horizontal">
452<dt>image</dt>
453<dd>the image The transformed image is returned as this parameter. </dd>
454
455<dd> </dd>
456<dt>crop_geometry</dt>
457<dd>A crop geometry string.  This geometry defines a subregion of the image to crop. </dd>
458
459<dd> </dd>
460<dt>image_geometry</dt>
461<dd>An image geometry string.  This geometry defines the final size of the image. </dd>
462
463<dd> </dd>
464<dt>exception</dt>
465<dd>return any errors or warnings in this structure. </dd>
466
467<dd>  </dd>
468</dl>
469<h2><a href="../../api/MagickCore/transform_8c.html" id="TransposeImage">TransposeImage</a></h2>
470
471<p>TransposeImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them by 90 degrees.</p>
472
473<p>The format of the TransposeImage method is:</p>
474
475<pre class="text">
476Image *TransposeImage(const Image *image,ExceptionInfo *exception)
477</pre>
478
479<p>A description of each parameter follows:</p>
480
481<dd>
482</dd>
483
484<dd> </dd>
485<dl class="dl-horizontal">
486<dt>image</dt>
487<dd>the image. </dd>
488
489<dd> </dd>
490<dt>exception</dt>
491<dd>return any errors or warnings in this structure. </dd>
492
493<dd>  </dd>
494</dl>
495<h2><a href="../../api/MagickCore/transform_8c.html" id="TransverseImage">TransverseImage</a></h2>
496
497<p>TransverseImage() creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them by 270 degrees.</p>
498
499<p>The format of the TransverseImage method is:</p>
500
501<pre class="text">
502Image *TransverseImage(const Image *image,ExceptionInfo *exception)
503</pre>
504
505<p>A description of each parameter follows:</p>
506
507<dd>
508</dd>
509
510<dd> </dd>
511<dl class="dl-horizontal">
512<dt>image</dt>
513<dd>the image. </dd>
514
515<dd> </dd>
516<dt>exception</dt>
517<dd>return any errors or warnings in this structure. </dd>
518
519<dd>  </dd>
520</dl>
521<h2><a href="../../api/MagickCore/transform_8c.html" id="TrimImage">TrimImage</a></h2>
522
523<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>
524
525<p>The format of the TrimImage method is:</p>
526
527<pre class="text">
528Image *TrimImage(const Image *image,ExceptionInfo *exception)
529</pre>
530
531<p>A description of each parameter follows:</p>
532
533<dd>
534</dd>
535
536<dd> </dd>
537<dl class="dl-horizontal">
538<dt>image</dt>
539<dd>the image. </dd>
540
541<dd> </dd>
542<dt>exception</dt>
543<dd>return any errors or warnings in this structure. </dd>
544
545<dd>  </dd>
546</dl>
547</div>
548    </div>
549  </main><!-- /.container -->
550  <footer class="magick-footer">
551    <p><a href="../../www/www/security-policy.html">Security</a> •
552    <a href="../../www/www/architecture.html">Architecture</a>
553
554    <a href="transform.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../www/images/wand.ico"/></a>
555
556    <a href="../../www/www/links.html">Related</a> •
557     <a href="../../www/www/sitemap.html">Sitemap</a>
558    <br/>
559    <a href="../../www/www/support.html">Donate</a> •
560    <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
561    <a href="../../www/www/contact.html">Contact Us</a>
562    <br/>
563    <small>© 1999-2020 ImageMagick Studio LLC</small></p>
564  </footer>
565
566  <!-- Javascript assets -->
567  <script src="../../www/assets/magick.js" crossorigin="anonymous"></script>
568  <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.4.1/jquery.min.js"><\/script>')</script>
569</body>
570</html>
571<!-- Magick Cache 4th January 2020 00:55 -->