blob: dce667889eb4f1575b2a52bb5805d7125f926d5b [file] [log] [blame]
cristy29dc8652015-05-12 16:26:21 +00001<!DOCTYPE html>
cristy44443b92015-05-05 00:06:07 +00002<html lang="en">
cristy06f63f22012-10-31 00:50:07 +00003<head>
cristy44443b92015-05-05 00:06:07 +00004 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
cristyffb69ed2010-12-25 00:06:48 +00007 <title>ImageMagick: MagickCore, C API for ImageMagick: Transform an Image</title>
cristy44443b92015-05-05 00:06:07 +00008 <meta http-equiv="content-language" content="en-US">
9 <meta http-equiv="content-type" content="text/html; charset=utf-8">
10 <meta http-equiv="reply-to" content="magick-users@imagemagick.org">
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 Bézier 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">
cristy4e638cd2015-05-07 16:47:40 +000022 <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
cristy44443b92015-05-05 00:06:07 +000023 <meta name="distribution" content="Global">
24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
cristy2f563d42015-05-06 23:36:51 +000025 <link rel="icon" href="../images/wand.png">
26 <link rel="shortcut icon" href="../images/wand.ico" type="images/x-icon">
27 <link rel="stylesheet" href="../css/bootstrap.min.css">
28 <link rel="stylesheet" href="../css/magick.css">
cristy06f63f22012-10-31 00:50:07 +000029</head>
30
cristy44443b92015-05-05 00:06:07 +000031<body>
cristy06f63f22012-10-31 00:50:07 +000032<div class="main">
cristy44443b92015-05-05 00:06:07 +000033<div class="magick-masthead">
34 <div class="container">
35 <script type="text/javascript">
36 <!--
37 google_ad_client = "pub-3129977114552745";
38 google_ad_slot = "5439289906";
39 google_ad_width = 728;
40 google_ad_height = 90;
41 //-->
42 </script>
43 <center><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
44 </script></center>
45 <nav class="magick-nav">
cristy2f563d42015-05-06 23:36:51 +000046 <a class="magick-nav-item " href="../index.html">Home</a>
cristyea2793e2015-05-31 16:52:26 +000047 <a class="magick-nav-item " href="../binary-releases.html">Download</a>
cristy38185362015-05-07 20:09:56 +000048 <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
49 <a class="magick-nav-item " href="../command-line-options.html">Options</a>
cristyea2793e2015-05-31 16:52:26 +000050 <a class="magick-nav-item " href="../resources.html">Resources</a>
51 <a class="magick-nav-item " href="api.html">Develop</a>
cristy5b8fe762015-06-09 16:24:03 +000052 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
cristya1890f02015-05-15 23:32:44 +000053 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristy44443b92015-05-05 00:06:07 +000054 </nav>
55 </div>
56</div>
57<div class="container">
cristy4e638cd2015-05-07 16:47:40 +000058<div class="magick-header">
cristycecc9492015-06-09 16:53:50 +000059<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#TransformImages">TransformImages</a><a href="transform.html#TransposeImage">TransposeImage</a><a href="transform.html#TransverseImage">TransverseImage</a><a href="transform.html#TrimImage">TrimImage</a></p>
cristy06f63f22012-10-31 00:50:07 +000060
cristycecc9492015-06-09 16:53:50 +000061<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="AutoOrientImage">AutoOrientImage</a></h2>
62
63<p>AutoOrientImage() adjusts an image so that its orientation is suitable for viewing (i.e. top-left orientation).</p>
64
65<p>The format of the AutoOrientImage method is:</p>
66
67<pre class="text">
68Image *AutoOrientImage(const Image *image,
69 const OrientationType orientation,ExceptionInfo *exception)
70</pre>
71
72<p>A description of each parameter follows:</p>
73
74<dd>
75</dd>
76
77<dd> </dd>
78<dl class="dl-horizontal">
79<dt>image</dt>
80<dd>The image. </dd>
81
82<dd> </dd>
83<dt>orientation</dt>
84<dd>Current image orientation. </dd>
85
86<dd> </dd>
87<dt>exception</dt>
88<dd>Return any errors or warnings in this structure. </dd>
89
90<dd> </dd>
91</dl>
92<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="ChopImage">ChopImage</a></h2>
93
94<p>ChopImage() removes a region of an image and collapses the image to occupy the removed portion.</p>
95
96<p>The format of the ChopImage method is:</p>
97
98<pre class="text">
99Image *ChopImage(const Image *image,const RectangleInfo *chop_info)
100 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>chop_info</dt>
115<dd>Define the region of the image to chop. </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="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="CropImage">CropImage</a></h2>
124
125<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>
126
127<p>The format of the CropImage method is:</p>
128
129<pre class="text">
130Image *CropImage(const Image *image,const RectangleInfo *geometry,
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>geometry</dt>
146<dd>Define the region of the image to crop with members x, y, width, and height. </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="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="CropImageToTiles">CropImageToTiles</a></h2>
155
156<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>
157
158<p>Image *CropImageToTiles(const Image *image, const RectangleInfo *crop_geometry, ExceptionInfo *exception)</p>
159
160<p>A description of each parameter follows:</p>
161
162<dd>
163</dd>
164
165<dd> </dd>
166<dl class="dl-horizontal">
167<dt>image</dt>
168<dd>the image The transformed image is returned as this parameter. </dd>
169
170<dd> </dd>
171<dt>crop_geometry</dt>
172<dd>A crop geometry string. </dd>
173
174<dd> </dd>
175<dt>exception</dt>
176<dd>return any errors or warnings in this structure. </dd>
177
178<dd> </dd>
179</dl>
180<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="ExcerptImage">ExcerptImage</a></h2>
181
182<p>ExcerptImage() returns a excerpt of the image as defined by the geometry.</p>
183
184<p>The format of the ExcerptImage method is:</p>
185
186<pre class="text">
187Image *ExcerptImage(const Image *image,const RectangleInfo *geometry,
188 ExceptionInfo *exception)
189</pre>
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. </dd>
200
201<dd> </dd>
202<dt>geometry</dt>
203<dd>Define the region of the image to extend with members x, y, width, and height. </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="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="ExtentImage">ExtentImage</a></h2>
212
213<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>
214
215<p>The format of the ExtentImage method is:</p>
216
217<pre class="text">
218Image *ExtentImage(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="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="FlipImage">FlipImage</a></h2>
243
244<p>FlipImage() creates a vertical mirror image by reflecting the pixels around the central x-axis.</p>
245
246<p>The format of the FlipImage method is:</p>
247
248<pre class="text">
249Image *FlipImage(const Image *image,ExceptionInfo *exception)
250</pre>
251
252<p>A description of each parameter follows:</p>
253
254<dd>
255</dd>
256
257<dd> </dd>
258<dl class="dl-horizontal">
259<dt>image</dt>
260<dd>the image. </dd>
261
262<dd> </dd>
263<dt>exception</dt>
264<dd>return any errors or warnings in this structure. </dd>
265
266<dd> </dd>
267</dl>
268<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="FlopImage">FlopImage</a></h2>
269
270<p>FlopImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis.</p>
271
272<p>The format of the FlopImage method is:</p>
273
274<pre class="text">
275Image *FlopImage(const Image *image,ExceptionInfo *exception)
276</pre>
277
278<p>A description of each parameter follows:</p>
279
280<dd>
281</dd>
282
283<dd> </dd>
284<dl class="dl-horizontal">
285<dt>image</dt>
286<dd>the image. </dd>
287
288<dd> </dd>
289<dt>exception</dt>
290<dd>return any errors or warnings in this structure. </dd>
291
292<dd> </dd>
293</dl>
294<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="RollImage">RollImage</a></h2>
295
296<p>RollImage() offsets an image as defined by x_offset and y_offset.</p>
297
298<p>The format of the RollImage method is:</p>
299
300<pre class="text">
301Image *RollImage(const Image *image,const ssize_t x_offset,
302 const ssize_t y_offset,ExceptionInfo *exception)
303</pre>
304
305<p>A description of each parameter follows:</p>
306
307<dd>
308</dd>
309
310<dd> </dd>
311<dl class="dl-horizontal">
312<dt>image</dt>
313<dd>the image. </dd>
314
315<dd> </dd>
316<dt>x_offset</dt>
317<dd>the number of columns to roll in the horizontal direction. </dd>
318
319<dd> </dd>
320<dt>y_offset</dt>
321<dd>the number of rows to roll in the vertical direction. </dd>
322
323<dd> </dd>
324<dt>exception</dt>
325<dd>return any errors or warnings in this structure. </dd>
326
327<dd> </dd>
328</dl>
329<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="ShaveImage">ShaveImage</a></h2>
330
331<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>
332
333<p>The format of the ShaveImage method is:</p>
334
335<pre class="text">
336Image *ShaveImage(const Image *image,const RectangleInfo *shave_info,
337 ExceptionInfo *exception)
338</pre>
339
340<p>A description of each parameter follows:</p>
341
342<dd>
343</dd>
344
345<dd> </dd>
346<dl class="dl-horizontal">
347<dt>shave_image</dt>
348<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>
349
350<dd> </dd>
351<dt>image</dt>
352<dd>the image. </dd>
353
354<dd> </dd>
355<dt>shave_info</dt>
356<dd>Specifies a pointer to a RectangleInfo which defines the region of the image to crop. </dd>
357
358<dd> </dd>
359<dt>exception</dt>
360<dd>return any errors or warnings in this structure. </dd>
361
362<dd> </dd>
363</dl>
364<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="SpliceImage">SpliceImage</a></h2>
365
366<p>SpliceImage() splices a solid color into the image as defined by the geometry.</p>
367
368<p>The format of the SpliceImage method is:</p>
369
370<pre class="text">
371Image *SpliceImage(const Image *image,const RectangleInfo *geometry,
372 ExceptionInfo *exception)
373</pre>
374
375<p>A description of each parameter follows:</p>
376
377<dd>
378</dd>
379
380<dd> </dd>
381<dl class="dl-horizontal">
382<dt>image</dt>
383<dd>the image. </dd>
384
385<dd> </dd>
386<dt>geometry</dt>
387<dd>Define the region of the image to splice with members x, y, width, and height. </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="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TransformImage">TransformImage</a></h2>
396
397<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>
398
399<p>This should only be used for single images.</p>
400
401<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>
402
403<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>
404
405<p>This function and should probably be deprecated in favor of direct calls to CropImageToTiles() or ResizeImage(), as appropriate.</p>
406
407<p>The format of the TransformImage method is:</p>
408
409<pre class="text">
410MagickBooleanType TransformImage(Image **image,const char *crop_geometry,
411 const char *image_geometry,ExceptionInfo *exception)
412</pre>
413
414<p>A description of each parameter follows:</p>
415
416<dd>
417</dd>
418
419<dd> </dd>
420<dl class="dl-horizontal">
421<dt>image</dt>
422<dd>the image The transformed image is returned as this parameter. </dd>
423
424<dd> </dd>
425<dt>crop_geometry</dt>
426<dd>A crop geometry string. This geometry defines a subregion of the image to crop. </dd>
427
428<dd> </dd>
429<dt>image_geometry</dt>
430<dd>An image geometry string. This geometry defines the final size of the image. </dd>
431
432<dd> </dd>
433<dt>exception</dt>
434<dd>return any errors or warnings in this structure. </dd>
435
436<dd> </dd>
437</dl>
438<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TransformImages">TransformImages</a></h2>
439
440<p>TransformImages() calls TransformImage() on each image of a sequence.</p>
441
442<p>The format of the TransformImage method is:</p>
443
444<pre class="text">
445MagickBooleanType TransformImages(Image **image,
446 const char *crop_geometry,const char *image_geometry,
447 ExceptionInfo *exception)
448</pre>
449
450<p>A description of each parameter follows:</p>
451
452<dd>
453</dd>
454
455<dd> </dd>
456<dl class="dl-horizontal">
457<dt>image</dt>
458<dd>the image The transformed image is returned as this parameter. </dd>
459
460<dd> </dd>
461<dt>crop_geometry</dt>
462<dd>A crop geometry string. This geometry defines a subregion of the image to crop. </dd>
463
464<dd> </dd>
465<dt>image_geometry</dt>
466<dd>An image geometry string. This geometry defines the final size of the image. </dd>
467
468<dd> </dd>
469<dt>exception</dt>
470<dd>return any errors or warnings in this structure. </dd>
471
472<dd> </dd>
473</dl>
474<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TransposeImage">TransposeImage</a></h2>
475
476<p>TransposeImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them by 90 degrees.</p>
477
478<p>The format of the TransposeImage method is:</p>
479
480<pre class="text">
481Image *TransposeImage(const Image *image,ExceptionInfo *exception)
482</pre>
483
484<p>A description of each parameter follows:</p>
485
486<dd>
487</dd>
488
489<dd> </dd>
490<dl class="dl-horizontal">
491<dt>image</dt>
492<dd>the image. </dd>
493
494<dd> </dd>
495<dt>exception</dt>
496<dd>return any errors or warnings in this structure. </dd>
497
498<dd> </dd>
499</dl>
500<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TransverseImage">TransverseImage</a></h2>
501
502<p>TransverseImage() creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them by 270 degrees.</p>
503
504<p>The format of the TransverseImage method is:</p>
505
506<pre class="text">
507Image *TransverseImage(const Image *image,ExceptionInfo *exception)
508</pre>
509
510<p>A description of each parameter follows:</p>
511
512<dd>
513</dd>
514
515<dd> </dd>
516<dl class="dl-horizontal">
517<dt>image</dt>
518<dd>the image. </dd>
519
520<dd> </dd>
521<dt>exception</dt>
522<dd>return any errors or warnings in this structure. </dd>
523
524<dd> </dd>
525</dl>
526<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/transform_8c.html" id="TrimImage">TrimImage</a></h2>
527
528<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>
529
530<p>The format of the TrimImage method is:</p>
531
532<pre class="text">
533Image *TrimImage(const Image *image,ExceptionInfo *exception)
534</pre>
535
536<p>A description of each parameter follows:</p>
537
538<dd>
539</dd>
540
541<dd> </dd>
542<dl class="dl-horizontal">
543<dt>image</dt>
544<dd>the image. </dd>
545
546<dd> </dd>
547<dt>exception</dt>
548<dd>return any errors or warnings in this structure. </dd>
549
550<dd> </dd>
551</dl>
cristy06f63f22012-10-31 00:50:07 +0000552</div>
cristy44443b92015-05-05 00:06:07 +0000553 <footer class="magick-footer">
cristy82a2ff22015-05-12 16:41:32 +0000554 <div class="magick-nav-item pull-left">
cristy38185362015-05-07 20:09:56 +0000555 <a href="../support.html">Donate</a>
cristy44443b92015-05-05 00:06:07 +0000556 </div>
cristy38185362015-05-07 20:09:56 +0000557 <p><a href="../sitemap.html">Sitemap</a>
558 <a href="../links.html">Related</a>
cristy44443b92015-05-05 00:06:07 +0000559 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a>
cristyea2793e2015-05-31 16:52:26 +0000560 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
cristy44443b92015-05-05 00:06:07 +0000561</p>
562 <p><a href="transform.html#">Back to top</a>
cristyea2793e2015-05-31 16:52:26 +0000563 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristy5b8fe762015-06-09 16:24:03 +0000564 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
cristya1890f02015-05-15 23:32:44 +0000565 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
cristy44443b92015-05-05 00:06:07 +0000566 </footer>
567</div><!-- /.container -->
cristy06f63f22012-10-31 00:50:07 +0000568
cristy44443b92015-05-05 00:06:07 +0000569 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
cristy2f563d42015-05-06 23:36:51 +0000570 <script src="../js/bootstrap.min.js"></script>
cristy44443b92015-05-05 00:06:07 +0000571 <script type="text/javascript">
cristy82a2ff22015-05-12 16:41:32 +0000572 /* <![CDATA[ */
cristy44443b92015-05-05 00:06:07 +0000573 (function() {
574 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
575 s.type = 'text/javascript';
576 s.async = true;
577 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
578 t.parentNode.insertBefore(s, t);
579 })();
cristy82a2ff22015-05-12 16:41:32 +0000580 /* ]]> */
cristy44443b92015-05-05 00:06:07 +0000581 </script>
cristy44cbd482013-08-04 20:53:36 +0000582</div>
cristy06f63f22012-10-31 00:50:07 +0000583</body>
cristy5a367e42015-05-05 12:39:18 +0000584</html>