]> granicus.if.org Git - imagemagick/blob - www/api/transform.html
f72ba0ab8a87e98fe2c207d76b0fd8a2736d819d
[imagemagick] / www / api / transform.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\r
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">\r
4 <head>\r
5   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>\r
6   <meta name="verify-v1" content="g222frIIxcQTrvDR3NBRUSKP3AnMNoqxOkIniCEkV7U=" />\r
7   <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf" />\r
8   <style type="text/css" media="all">\r
9     @import url("../../www/magick.css");\r
10   </style>\r
11   <link rel="shortcut icon" href="../../images/wand.ico"  type="images/vnd.microsoft.icon"/>
12   <title>ImageMagick: MagickCore, C API for ImageMagick: Transform an Image</title>
13   <meta http-equiv="Content-Language" content="en-US"/>
14   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
15   <meta http-equiv="Reply-to" content="magick-users@imagemagick.org"/>
16   <meta name="Generator" content="PHP"/>
17   <meta name="Keywords" content="magickcore, c, api, for, imagemagick:, transform, an, image, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject, Swiss, Army, Knife, Image, Processing"/>
18   <meta name="Description" content="ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (about 100) including GIF, JPEG, JPEG-2000, PNG, PDF, PhotoCD, TIFF, and DPX. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.  ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you can freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems.  The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite programming language. Choose from these interfaces: MagickCore (C), MagickWand (C), ChMagick (Ch), Magick++ (C++), JMagick (Java), L-Magick (Lisp), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (PHP), PythonMagick (Python), RMagick (Ruby), or TclMagick (Tcl/TK). With a language interface, use ImageMagick to modify or create images automagically and dynamically."/>
19   <meta name="Rating" content="GENERAL"/>
20   <meta name="Robots" content="INDEX, FOLLOW"/>
21   <meta name="Generator" content="ImageMagick Studio LLC"/>
22   <meta name="Author" content="ImageMagick Studio LLC"/>
23   <meta name="Revisit-after" content="2 DAYS"/>
24   <meta name="Resource-type" content="document"/>
25   <meta name="Copyright" content="Copyright (c) 1999-2010 ImageMagick Studio LLC"/>
26   <meta name="Distribution" content="Global"/>
27 </head>\r
28 \r
29 <body id="www-imagemagick-org">\r
30 <div class="titlebar">\r
31 <a href="../../index.html">\r
32   <img src="../../images/script.png" alt="[ImageMagick]"\r
33   style="width: 350px; height: 60px; margin: 28px auto; float: left;" /></a>\r
34 <a href="http://www.networkredux.com">\r
35   <img src="../../images/networkredux.png" alt="[sponsor]"\r
36   style="margin: 45px auto; border: 0px; float: left;" /></a>\r
37 <a href="http://www.imagemagick.org/discourse-server/">\r
38   <img src="../../images/logo.jpg" alt=""\r
39   style="width: 114px; height: 118px; border: 0px; float: right;" /></a>\r
40 <a href="../../index.html">\r
41   <img src="../../images/sprite.jpg" alt=""\r
42   style="width: 114px; height: 118px; border: 0px; float: right;" /></a>\r
43 </div>\r
44 \r
45 <div class="westbar">\r
46 \r
47 <div class="menu">
48   <a title="About ImageMagick" href="../../index.html">About ImageMagick</a>
49 </div>
50 <div class="sep"></div>\r
51 <div class="menu">
52   <a title="Binary Releases" href="../../www/binary-releases.html">Binary Releases</a>
53 </div>
54 <div class="sub">
55     <a title="Binary Release: Unix" href="../../www/binary-releases.html#unix">Unix</a>
56 </div>
57 <div class="sub">
58     <a title="Binary Release: MacOS X" href="../../www/binary-releases.html#macosx">Mac OS X</a>
59 </div>
60 <div class="sub">
61     <a title="Binary Release: Windows" href="../../www/binary-releases.html#windows">Windows</a>
62 </div>
63 <div class="sep"></div>\r
64 <div class="menu">
65   <a title="Command-line Tools" href="../../www/command-line-tools.html">Command-line Tools</a>
66 </div>
67 <div class="sub">
68     <a title="Command-line Tools: Processing" href="../../www/command-line-processing.html">Processing</a>
69 </div>
70 <div class="sub">
71     <a title="Command-line Tools: Options" href="../../www/command-line-options.html">Options</a>
72 </div>
73 <div class="sub">
74     <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
75 </div>
76 <div class="menu">
77   <a title="Program Interfaces" href="../../www/api.html">Program Interfaces</a>
78 </div>
79 <div class="sub">
80     <a title="Program Interface: MagickWand" href="../../www/magick-wand.html">MagickWand</a>
81 </div>
82 <div class="sub">
83     <a title="Program Interface: MagickCore" href="../../www/magick-core.html">MagickCore</a>
84 </div>
85 <div class="sub">
86     <a title="Program Interface: PerlMagick" href="../../www/perl-magick.html">PerlMagick</a>
87 </div>
88 <div class="sub">
89     <a title="Program Interface: Magick++" href="../../Magick++/">Magick++</a>
90 </div>
91 <div class="sep"></div>\r
92 <div  class="menu">
93    <a title="Install from Source" href="../../www/install-source.html">Install from Source</a>
94 </div>
95 <div class="sub">
96     <a title="Install from Source: Unix" href="../../www/install-source.html#unix">Unix</a>
97 </div>
98 <div class="sub">
99     <a title="Install from Source: Windows" href="../../www/install-source.html#windows">Windows</a>
100  </div>
101 <div class="menu">
102   <a title="Resources" href="../../www/resources.html">Resources</a>
103 </div>
104 <div class="menu">
105   <a title="Architecture" href="../../www/architecture.html">Architecture</a>
106 </div>
107 <div class="menu">
108   <a title="Download" href="../../www/download.html">Download</a>
109 </div>
110 <div class="sep"></div>\r
111 <div class="menu">
112   <a title="Search" href="../http://www.imagemagick.org/script/search.php">Search</a>
113 </div>
114 <div class="sep"></div>\r
115 <div class="menu">
116   <a title="Site Map"href="../../www/sitemap.html">Site Map</a>
117 </div>
118 <div  class="sub">
119     <a title="Site Map: Links"href="../../www/links.html">Links</a>
120 </div>
121 <div class="sep"></div>\r
122 <div  class="menu">
123   <a title="Sponsors" href="../../www/sponsors.html">Sponsors:</a>
124
125 <div class="sponsbox">
126 <div  class="sponsor">
127   <a title="Sponsor: Webdesign Agentur" href="http://www.ventzke-partner.de">Webdesign Agentur</a><!-- 201101010480 invendio.de-->
128 </div>
129 <div  class="sponsor">
130   <a title="Sponsor: LVM Versicherung" href="http://www.neu-reich.de">LVM Versicherung</a><!-- 201101010480 -->
131 </div>
132 <div  class="sponsor">
133   <a title="Sponsor: Deko.net" href="http://www.deko.net">Deko.net</a><!-- 201101010600 Peterssen-->
134 </div>
135 <div  class="sponsor">
136   <a title="Sponsor: Druckerei" href="http://www.print24.de/">Druckerei</a><!-- 201009010720 -->
137 </div>
138 <div  class="sponsor">
139    <a title="Sponsor: Druckerei Online" href="http://www.allesdruck.de">Druckerei Online</a><!-- 201012011200 allesdruck.de-->
140 </div>
141 <div  class="sponsor">
142    <a title="Sponsor: Free Catalogs" href="http://www.who-sells-it.com/">Free Catalogs</a><!-- 20120801000600 -->
143 </div>
144 </div>
145 </div>
146 </div>\r
147 \r
148 <div class="eastbar">\r
149   <script type="text/javascript">\r
150   <!--\r
151     google_ad_client = "pub-3129977114552745";\r
152     /* 160x600, created 7/27/10 */\r
153     google_ad_slot = "0574824969";\r
154     google_ad_width = 160;\r
155     google_ad_height = 600;\r
156   //-->\r
157   </script>\r
158   <script type="text/javascript"\r
159     src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\r
160   </script>\r
161 </div>\r
162 \r
163 <div class="main">\r
164 \r
165 <p class="navigation-index">[<a href="#ChopImage">ChopImage</a> &bull; <a href="#CropImage">CropImage</a> &bull; <a href="#ExcerptImage">ExcerptImage</a> &bull; <a href="#ExtentImage">ExtentImage</a> &bull; <a href="#FlipImage">FlipImage</a> &bull; <a href="#FlopImage">FlopImage</a> &bull; <a href="#RollImage">RollImage</a> &bull; <a href="#ShaveImage">ShaveImage</a> &bull; <a href="#SpliceImage">SpliceImage</a> &bull; <a href="#TransformImage">TransformImage</a> &bull; <a href="#TransformImages">TransformImages</a> &bull; <a href="#TransposeImage">TransposeImage</a> &bull; <a href="#TransverseImage">TransverseImage</a> &bull; <a href="#TrimImage">TrimImage</a>]</p>
166
167 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
168 _8c.html" target="source" name="ChopImage">ChopImage</a></h2>
169 <div class="doc-section">
170
171 <p>ChopImage() removes a region of an image and collapses the image to occupy the removed portion.</p></ol>
172
173 <p>The format of the ChopImage method is:</p>
174
175 <pre class="code">
176   Image *ChopImage(const Image *image,const RectangleInfo *chop_info)
177     ExceptionInfo *exception)
178 </pre>
179
180 <p>A description of each parameter follows:</p></ol>
181
182 <h5>image</h5>
183 <ol><p>the image.</p></ol>
184
185 <h5>chop_info</h5>
186 <ol><p>Define the region of the image to chop.</p></ol>
187
188 <h5>exception</h5>
189 <ol><p>return any errors or warnings in this structure.</p></ol>
190
191  </div>
192 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
193 _8c.html" target="source" name="CropImage">CropImage</a></h2>
194 <div class="doc-section">
195
196 <p>CropImage() extracts a region of the image starting at the offset defined by geometry.</p></ol>
197
198 <p>The format of the CropImage method is:</p>
199
200 <pre class="code">
201   Image *CropImage(const Image *image,const RectangleInfo *geometry,
202     ExceptionInfo *exception)
203 </pre>
204
205 <p>A description of each parameter follows:</p></ol>
206
207 <h5>image</h5>
208 <ol><p>the image.</p></ol>
209
210 <h5>geometry</h5>
211 <ol><p>Define the region of the image to crop with members x, y, width, and height.</p></ol>
212
213 <h5>exception</h5>
214 <ol><p>return any errors or warnings in this structure.</p></ol>
215
216  </div>
217 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
218 _8c.html" target="source" name="ExcerptImage">ExcerptImage</a></h2>
219 <div class="doc-section">
220
221 <p>ExcerptImage() returns a excerpt of the image as defined by the geometry.</p></ol>
222
223 <p>The format of the ExcerptImage method is:</p>
224
225 <pre class="code">
226   Image *ExcerptImage(const Image *image,const RectangleInfo *geometry,
227     ExceptionInfo *exception)
228 </pre>
229
230 <p>A description of each parameter follows:</p></ol>
231
232 <h5>image</h5>
233 <ol><p>the image.</p></ol>
234
235 <h5>geometry</h5>
236 <ol><p>Define the region of the image to extend with members x, y, width, and height.</p></ol>
237
238 <h5>exception</h5>
239 <ol><p>return any errors or warnings in this structure.</p></ol>
240
241  </div>
242 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
243 _8c.html" target="source" name="ExtentImage">ExtentImage</a></h2>
244 <div class="doc-section">
245
246 <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></ol>
247
248 <p>The format of the ExtentImage method is:</p>
249
250 <pre class="code">
251   Image *ExtentImage(const Image *image,const RectangleInfo *geometry,
252     ExceptionInfo *exception)
253 </pre>
254
255 <p>A description of each parameter follows:</p></ol>
256
257 <h5>image</h5>
258 <ol><p>the image.</p></ol>
259
260 <h5>geometry</h5>
261 <ol><p>Define the region of the image to extend with members x, y, width, and height.</p></ol>
262
263 <h5>exception</h5>
264 <ol><p>return any errors or warnings in this structure.</p></ol>
265
266  </div>
267 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
268 _8c.html" target="source" name="FlipImage">FlipImage</a></h2>
269 <div class="doc-section">
270
271 <p>FlipImage() creates a vertical mirror image by reflecting the pixels around the central x-axis.</p></ol>
272
273 <p>The format of the FlipImage method is:</p>
274
275 <pre class="code">
276   Image *FlipImage(const Image *image,ExceptionInfo *exception)
277 </pre>
278
279 <p>A description of each parameter follows:</p></ol>
280
281 <h5>image</h5>
282 <ol><p>the image.</p></ol>
283
284 <h5>exception</h5>
285 <ol><p>return any errors or warnings in this structure.</p></ol>
286
287  </div>
288 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
289 _8c.html" target="source" name="FlopImage">FlopImage</a></h2>
290 <div class="doc-section">
291
292 <p>FlopImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis.</p></ol>
293
294 <p>The format of the FlopImage method is:</p>
295
296 <pre class="code">
297   Image *FlopImage(const Image *image,ExceptionInfo *exception)
298 </pre>
299
300 <p>A description of each parameter follows:</p></ol>
301
302 <h5>image</h5>
303 <ol><p>the image.</p></ol>
304
305 <h5>exception</h5>
306 <ol><p>return any errors or warnings in this structure.</p></ol>
307
308  </div>
309 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
310 _8c.html" target="source" name="RollImage">RollImage</a></h2>
311 <div class="doc-section">
312
313 <p>RollImage() offsets an image as defined by x_offset and y_offset.</p></ol>
314
315 <p>The format of the RollImage method is:</p>
316
317 <pre class="code">
318   Image *RollImage(const Image *image,const ssize_t x_offset,
319     const ssize_t y_offset,ExceptionInfo *exception)
320 </pre>
321
322 <p>A description of each parameter follows:</p></ol>
323
324 <h5>image</h5>
325 <ol><p>the image.</p></ol>
326
327 <h5>x_offset</h5>
328 <ol><p>the number of columns to roll in the horizontal direction.</p></ol>
329
330 <h5>y_offset</h5>
331 <ol><p>the number of rows to roll in the vertical direction.</p></ol>
332
333 <h5>exception</h5>
334 <ol><p>return any errors or warnings in this structure.</p></ol>
335
336  </div>
337 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
338 _8c.html" target="source" name="ShaveImage">ShaveImage</a></h2>
339 <div class="doc-section">
340
341 <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></ol>
342
343 <p>The format of the ShaveImage method is:</p>
344
345 <pre class="code">
346   Image *ShaveImage(const Image *image,const RectangleInfo *shave_info,
347     ExceptionInfo *exception)
348 </pre>
349
350 <p>A description of each parameter follows:</p></ol>
351
352 <h5>shave_image</h5>
353 <ol><p>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.</p></ol>
354
355 <h5>image</h5>
356 <ol><p>the image.</p></ol>
357
358 <h5>shave_info</h5>
359 <ol><p>Specifies a pointer to a RectangleInfo which defines the region of the image to crop.</p></ol>
360
361 <h5>exception</h5>
362 <ol><p>return any errors or warnings in this structure.</p></ol>
363
364  </div>
365 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
366 _8c.html" target="source" name="SpliceImage">SpliceImage</a></h2>
367 <div class="doc-section">
368
369 <p>SpliceImage() splices a solid color into the image as defined by the geometry.</p></ol>
370
371 <p>The format of the SpliceImage method is:</p>
372
373 <pre class="code">
374   Image *SpliceImage(const Image *image,const RectangleInfo *geometry,
375     ExceptionInfo *exception)
376 </pre>
377
378 <p>A description of each parameter follows:</p></ol>
379
380 <h5>image</h5>
381 <ol><p>the image.</p></ol>
382
383 <h5>geometry</h5>
384 <ol><p>Define the region of the image to splice with members x, y, width, and height.</p></ol>
385
386 <h5>exception</h5>
387 <ol><p>return any errors or warnings in this structure.</p></ol>
388
389  </div>
390 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
391 _8c.html" target="source" name="TransformImage">TransformImage</a></h2>
392 <div class="doc-section">
393
394 <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 returned.</p></ol>
395
396 <p>The format of the TransformImage method is:</p>
397
398 <pre class="code">
399   MagickBooleanType TransformImage(Image **image,const char *crop_geometry,
400     const char *image_geometry)
401 </pre>
402
403 <p>A description of each parameter follows:</p></ol>
404
405 <h5>image</h5>
406 <ol><p>the image The transformed image is returned as this parameter.</p></ol>
407
408 <h5>crop_geometry</h5>
409 <ol><p>A crop geometry string.  This geometry defines a subregion of the image to crop.</p></ol>
410
411 <h5>image_geometry</h5>
412 <ol><p>An image geometry string.  This geometry defines the final size of the image.</p></ol>
413
414  </div>
415 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
416 _8c.html" target="source" name="TransformImages">TransformImages</a></h2>
417 <div class="doc-section">
418
419 <p>TransformImages() calls TransformImage() on each image of a sequence.</p></ol>
420
421 <p>The format of the TransformImage method is:</p>
422
423 <pre class="code">
424   MagickBooleanType TransformImages(Image **image,
425     const char *crop_geometry,const char *image_geometry)
426 </pre>
427
428 <p>A description of each parameter follows:</p></ol>
429
430 <h5>image</h5>
431 <ol><p>the image The transformed image is returned as this parameter.</p></ol>
432
433 <h5>crop_geometry</h5>
434 <ol><p>A crop geometry string.  This geometry defines a subregion of the image to crop.</p></ol>
435
436 <h5>image_geometry</h5>
437 <ol><p>An image geometry string.  This geometry defines the final size of the image.</p></ol>
438
439  </div>
440 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
441 _8c.html" target="source" name="TransposeImage">TransposeImage</a></h2>
442 <div class="doc-section">
443
444 <p>TransposeImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them by 90 degrees.</p></ol>
445
446 <p>The format of the TransposeImage method is:</p>
447
448 <pre class="code">
449   Image *TransposeImage(const Image *image,ExceptionInfo *exception)
450 </pre>
451
452 <p>A description of each parameter follows:</p></ol>
453
454 <h5>image</h5>
455 <ol><p>the image.</p></ol>
456
457 <h5>exception</h5>
458 <ol><p>return any errors or warnings in this structure.</p></ol>
459
460  </div>
461 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
462 _8c.html" target="source" name="TransverseImage">TransverseImage</a></h2>
463 <div class="doc-section">
464
465 <p>TransverseImage() creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them by 270 degrees.</p></ol>
466
467 <p>The format of the TransverseImage method is:</p>
468
469 <pre class="code">
470   Image *TransverseImage(const Image *image,ExceptionInfo *exception)
471 </pre>
472
473 <p>A description of each parameter follows:</p></ol>
474
475 <h5>image</h5>
476 <ol><p>the image.</p></ol>
477
478 <h5>exception</h5>
479 <ol><p>return any errors or warnings in this structure.</p></ol>
480
481  </div>
482 <h2><a href="http://www.imagemagick.org/api/MagickCore/transform
483 _8c.html" target="source" name="TrimImage">TrimImage</a></h2>
484 <div class="doc-section">
485
486 <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></ol>
487
488 <p>The format of the TrimImage method is:</p>
489
490 <pre class="code">
491   Image *TrimImage(const Image *image,ExceptionInfo *exception)
492 </pre>
493
494 <p>A description of each parameter follows:</p></ol>
495
496 <h5>image</h5>
497 <ol><p>the image.</p></ol>
498
499 <h5>exception</h5>
500 <ol><p>return any errors or warnings in this structure.</p></ol>
501
502  </div>
503 \r
504 </div>\r
505 \r
506 <div id="linkbar">\r
507     <span id="linkbar-west">&nbsp;</span>\r
508     <span id="linkbar-center">\r
509       <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> &bull;\r
510       <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>\r
511     </span>\r
512     <span id="linkbar-east">&nbsp;</span>\r
513   </div>\r
514   <div class="footer">\r
515     <span id="footer-west">&copy; 1999-2010 ImageMagick Studio LLC</span>\r
516     <span id="footer-east"> <a href="../http://www.imagemagick.org/script/contact.php">Contact the Wizards</a></span>\r
517   </div>\r
518   <div style="clear: both; margin: 0; width: 100%; "></div>\r
519   <script type="text/javascript">\r
520     var _gaq = _gaq || [];\r
521     _gaq.push(['_setAccount', 'UA-17690367-1']);\r
522     _gaq.push(['_trackPageview']);\r
523 \r
524     (function() {\r
525       var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\r
526       ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\r
527       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\r
528     })();\r
529   </script>\r
530 </body>\r
531 </html>\r