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