blob: a89d13e9884ddc394665c073a74f671e167eb7ee [file] [log] [blame]
cristy06f63f22012-10-31 00:50:07 +00001<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html version="-//W3C//DTD XHTML 1.1//EN"
4 xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xsi:schemaLocation="http://www.w3.org/1999/xhtml
7 http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
8<head>
9 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
10 <meta name="google-site-verification" content="MxsMq6bdLOx0KSuz1MY6yG9ZTIJ7_7DVRfl5NCAT5Yg"/>
cristyffb69ed2010-12-25 00:06:48 +000011 <title>ImageMagick: MagickCore, C API for ImageMagick: Dealing with Image Layers</title>
cristy751980d2012-06-03 23:18:35 +000012 <meta http-equiv="content-language" content="en-US"/>
13 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
14 <meta http-equiv="reply-to" content="magick-users@imagemagick.org"/>
15 <meta name="application-name" content="ImageMagick"/>
16 <meta name="description" content="Use ImageMagick to convert, edit, or compose bitmap images in a variety of formats. In addition resize, rotate, shear, distort and transform images automagically."/>
17 <meta name="application-url" content="http://www.imagemagick.org"/>
18 <meta name="generator" content="PHP"/>
cristy72da67d2013-02-24 21:40:48 +000019 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, dealing, with, image, layers, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject, Image, Processing, Automagically"/>
cristy751980d2012-06-03 23:18:35 +000020 <meta name="rating" content="GENERAL"/>
21 <meta name="robots" content="INDEX, FOLLOW"/>
22 <meta name="generator" content="ImageMagick Studio LLC"/>
23 <meta name="author" content="ImageMagick Studio LLC"/>
24 <meta name="revisit-after" content="2 DAYS"/>
25 <meta name="resource-type" content="document"/>
cristy72da67d2013-02-24 21:40:48 +000026 <meta name="copyright" content="Copyright (c) 1999-2012 ImageMagick Studio LLC"/>
cristy751980d2012-06-03 23:18:35 +000027 <meta name="distribution" content="Global"/>
cristy72da67d2013-02-24 21:40:48 +000028 <link rel="icon" href="../../images/wand.png"/>
29 <link rel="shortcut icon" href="../../images/wand.ico" type="images/x-icon"/>
cristy06f63f22012-10-31 00:50:07 +000030 <link rel="canonical" href="http://www.imagemagick.org" />
31 <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>
cristy06f63f22012-10-31 00:50:07 +000032 <link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />
cristy72da67d2013-02-24 21:40:48 +000033 <link rel="stylesheet" type="text/css" href="http://www.imagemagick.org/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
cristy06f63f22012-10-31 00:50:07 +000034 <style type="text/css" media="all">
cristyd8833bf2013-02-24 22:14:53 +000035 @import url("../../style/magick.html");
cristy06f63f22012-10-31 00:50:07 +000036 </style>
cristy72da67d2013-02-24 21:40:48 +000037 <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
38 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
39 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
40 <script type="text/javascript">
41 $(document).ready(function() {
42 $("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox({
43 'transitionIn' : 'elastic',
44 'transitionOut' : 'elastic',
45 'overlayShow' : false,
46 'opacity' : true
47 });
48 });
49 </script>
cristy06f63f22012-10-31 00:50:07 +000050</head>
51
52<body id="www-imagemagick-org">
53<div class="titlebar">
54<div style="margin: 17px auto; float: left;">
55 <script type="text/javascript">
56 <!--
57 google_ad_client = "pub-3129977114552745";
58 google_ad_slot = "5439289906";
59 google_ad_width = 728;
60 google_ad_height = 90;
61 //-->
62 </script>
63 <script type="text/javascript"
64 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
65 </script>
66</div>
cristy72da67d2013-02-24 21:40:48 +000067<a href="../../discourse-server">
68 <img src="../../images/logo.jpg"
cristy06f63f22012-10-31 00:50:07 +000069 alt="ImageMagick Logo"
70 style="width: 123px; height: 118px; border: 0px; float: right;" /></a>
cristyd8833bf2013-02-24 22:14:53 +000071<a href="http://www.imagemagick.org/ImageMagick-7.0.0/index.html">
cristy72da67d2013-02-24 21:40:48 +000072 <img src="../../images/sprite.jpg"
cristy06f63f22012-10-31 00:50:07 +000073 alt="ImageMagick Sprite"
74 style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
75</div>
76
77<div class="westbar">
78
cristy3ed852e2009-09-05 21:47:34 +000079<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +000080 <a title="About ImageMagick" href="http://www.imagemagick.org/ImageMagick-7.0.0/index.html">About ImageMagick</a>
cristy3ed852e2009-09-05 21:47:34 +000081</div>
cristy3ed852e2009-09-05 21:47:34 +000082<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +000083 <a title="Binary Releases" href="../../www/binary-releases.html">Binary Releases</a>
cristybb503372010-05-27 20:51:26 +000084</div>
85<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +000086 <a title="Binary Release: Unix" href="../../www/binary-releases.html#unix">Unix</a>
cristybb503372010-05-27 20:51:26 +000087</div>
88<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +000089 <a title="Binary Release: MacOS X" href="../../www/binary-releases.html#macosx">Mac OS X</a>
cristybb503372010-05-27 20:51:26 +000090</div>
91<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +000092 <a title="Binary Release: iOS" href="../../www/binary-releases.html#iOS">iOS</a>
cristyda16f162011-02-19 23:52:17 +000093</div>
94<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +000095 <a title="Binary Release: Windows" href="../../www/binary-releases.html#windows">Windows</a>
cristybb503372010-05-27 20:51:26 +000096</div>
cristy06f63f22012-10-31 00:50:07 +000097<div class="sep"></div>
cristybb503372010-05-27 20:51:26 +000098<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +000099 <a title="Command-line Tools" href="../../www/command-line-tools.html">Command-line Tools</a>
cristy3ed852e2009-09-05 21:47:34 +0000100</div>
101<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000102 <a title="Command-line Tools: Processing" href="../../www/command-line-processing.html">Processing</a>
cristy3ed852e2009-09-05 21:47:34 +0000103</div>
104<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000105 <a title="Command-line Tools: Options" href="../../www/command-line-options.html">Options</a>
cristy3ed852e2009-09-05 21:47:34 +0000106</div>
107<div class="sub">
cristy83a272e2010-05-07 20:40:35 +0000108 <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
cristy3ed852e2009-09-05 21:47:34 +0000109</div>
110<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000111 <a title="Program Interfaces" href="../../www/api.html">Program Interfaces</a>
cristy3ed852e2009-09-05 21:47:34 +0000112</div>
113<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000114 <a title="Program Interface: MagickWand" href="../../www/magick-wand.html">MagickWand</a>
cristy3ed852e2009-09-05 21:47:34 +0000115</div>
116<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000117 <a title="Program Interface: MagickCore" href="../../www/magick-core.html">MagickCore</a>
cristy3ed852e2009-09-05 21:47:34 +0000118</div>
119<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000120 <a title="Program Interface: PerlMagick" href="../../www/perl-magick.html">PerlMagick</a>
cristy3ed852e2009-09-05 21:47:34 +0000121</div>
122<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000123 <a title="Program Interface: Magick++" href="../../www/magick++.html">Magick++</a>
cristy3ed852e2009-09-05 21:47:34 +0000124</div>
cristy06f63f22012-10-31 00:50:07 +0000125<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +0000126<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000127 <a title="Install from Source" href="../../www/install-source.html">Install from Source</a>
cristy3ed852e2009-09-05 21:47:34 +0000128</div>
129<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000130 <a title="Install from Source: Unix" href="../../www/install-source.html#unix">Unix</a>
cristy3ed852e2009-09-05 21:47:34 +0000131</div>
132<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000133 <a title="Install from Source: Windows" href="../../www/install-source.html#windows">Windows</a>
cristy3ed852e2009-09-05 21:47:34 +0000134 </div>
135<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000136 <a title="Resources" href="../../www/resources.html">Resources</a>
cristy3ed852e2009-09-05 21:47:34 +0000137</div>
cristybb503372010-05-27 20:51:26 +0000138<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000139 <a title="Architecture" href="../../www/architecture.html">Architecture</a>
cristybb503372010-05-27 20:51:26 +0000140</div>
cristy3ed852e2009-09-05 21:47:34 +0000141<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000142 <a title="Download" href="../../www/download.html">Download</a>
cristy3ed852e2009-09-05 21:47:34 +0000143</div>
cristy06f63f22012-10-31 00:50:07 +0000144<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +0000145<div class="menu">
cristy3dfa2192013-02-24 22:46:05 +0000146 <a title="Search" href="http://www.imagemagick.org/script/search.php">Search</a>
cristy3ed852e2009-09-05 21:47:34 +0000147</div>
cristy06f63f22012-10-31 00:50:07 +0000148<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +0000149<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000150 <a title="Site Map" href="../../www/sitemap.html">Site Map</a>
cristy3ed852e2009-09-05 21:47:34 +0000151</div>
152<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000153 <a title="Site Map: Links" href="../../www/links.html">Links</a>
cristy3ed852e2009-09-05 21:47:34 +0000154</div>
cristy06f63f22012-10-31 00:50:07 +0000155<div class="sep"></div>
cristy72da67d2013-02-24 21:40:48 +0000156<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000157 <a rel="follow" title="Sponsors" href="../../www/sponsors.html">Sponsors:</a>
cristy3ed852e2009-09-05 21:47:34 +0000158
cristy72da67d2013-02-24 21:40:48 +0000159<a href="http://www.networkredux.com">
160 <img src="../../images/networkredux.png" width="140" height="31" alt="[sponsor]"
161 style="margin-top: 4px; margin-left: 4px; border: 0px; float: left;" /></a>
cristy3ed852e2009-09-05 21:47:34 +0000162<div class="sponsbox">
cristy72da67d2013-02-24 21:40:48 +0000163<div class="sponsor">
cristyeed6cb62012-01-28 19:38:34 +0000164 <a rel="follow" title="Sponsor: Druckerei" href="http://print24.com/de/">Druckerei</a><!-- 2012070100250 ... -->
165</div>
cristy72da67d2013-02-24 21:40:48 +0000166<div class="sponsor">
167 <a rel="follow" title="Sponsor: Stock Photography" href="http://www.fotosearch.com/">Stock Photography</a><!-- 2012040100250 ... -->
168</div>
169<div class="sponsor">
170 <a rel="follow" title="Sponsor: Best Local Services" href="http://www.openchime.com">Best Local Services</a><!-- 2012010100150 joey@openc... -->
171</div>
172<div class="sponsor">
cristyeed6cb62012-01-28 19:38:34 +0000173 <a rel="follow" title="Sponsor: Managed Server" href="http://www.robhost.de">Managed Server</a><!-- 201210010720 klikics... -->
174</div>
cristy72da67d2013-02-24 21:40:48 +0000175<div class="sponsor">
176 <a rel="follow" title="Sponsor: VPS" href="http://www.interdominios.com/vps">VPS</a><!-- 201201010090 barsh@inter... -->
177</div>
178<div class="sponsor">
179 <a rel="follow" title="Sponsor: Autoteile" href="http://www.q11-shop.de">Autoteile</a><!-- 201205010540 suvalj -->
180</div>
181<div class="sponsor">
182 <a rel="follow" title="Sponsor: Web Hosting" href="http://www.micfo.com">Web Hosting</a><!-- 209901010090s golestan -->
183</div>
184<div class="sponsor">
185 <a rel="follow" title="Sponsor: Web Hosting Deals" href="http://www.webhostingdeals.org">Web Hosting Deals</a><!-- 201111010270 chee.hoa darin -->
186</div>
187<div class="sponsor">
188 <a rel="follow" title="Sponsor: Autos part" href="http://www.pkwteile.de/autoteile">Autos part</a><!-- 201112010090s jr@pkwte... -->
189</div>
190<div class="sponsor">
191 <a rel="follow" title="Sponsor: Web Hosting Reviews" href="http://www.webhostingsecretrevealed.com">Web Hosting Secret Revealed</a><!-- 201204010540 iamchee jerry -->
192</div>
193<div class="sponsor">
cristy10549a12011-05-15 19:04:46 +0000194 <a rel="follow" title="Sponsor: Druckerei" href="http://www.allesdruck.de">Druckerei</a><!-- 201303011500 r.leo -->
cristy4c54bbb2011-03-17 13:53:13 +0000195</div>
cristy72da67d2013-02-24 21:40:48 +0000196<div class="sponsor">
197 <a rel="follow" title="Sponsor: Hotel München" href="http://www.messehotel-erb-muenchen.de">Hotel München</a><!-- 201111010450 cerb -->
cristy4bf6e232011-05-21 01:43:33 +0000198</div>
cristy72da67d2013-02-24 21:40:48 +0000199<div class="sponsor">
200 <a rel="follow" title="Sponsor: Notebook Reparatur" href="http://www.notebook-reparaturen-berlin.de">Notebook Reparatur</a><!-- 2012020100300 atlas.multimedia-->
201</div>
202<div class="sponsor">
203 <a rel="follow" title="Sponsor: Got Stripes?" href="http://www.stripeslawncare.org">Got Stripes?</a><!-- 2012010100150 brooks@stripes...-->
cristyec6b4752011-01-08 03:16:23 +0000204</div>
cristy3ed852e2009-09-05 21:47:34 +0000205</div>
206</div>
cristy06f63f22012-10-31 00:50:07 +0000207</div>
208
209<div class="eastbar">
210 <div class="g-plusone" id="gplusone"></div>
211 <script type="text/javascript">
212 window.___gcfg = {
213 lang: 'en-US'
214 };
215
216 (function() {
cristy18b955e2013-02-24 21:06:33 +0000217 var po = document.createElement('offline-script');
cristy06f63f22012-10-31 00:50:07 +0000218 po.type = 'text/javascript'; po.async = true;
219 po.src = 'https://apis.google.com/js/plusone.js';
cristy18b955e2013-02-24 21:06:33 +0000220 var script = document.getElementsByTagName('offline-script')[0];
cristy06f63f22012-10-31 00:50:07 +0000221 script.parentNode.insertBefore(po, script);
222 })();
223 var gplusone = document.getElementById("gplusone");
224 gplusone.setAttribute("data-size","medium");
225 gplusone.setAttribute("data-count","false");
226 </script>
227</div>
228
229<div class="main">
230
cristy20398432011-08-11 01:31:50 +0000231<h1>Module layer Methods</h1>
cristyd8833bf2013-02-24 22:14:53 +0000232<p class="navigation-index">[<a href="layer.html#CoalesceImages">CoalesceImages</a> &bull; <a href="layer.html#DisposeImages">DisposeImages</a> &bull; <a href="layer.html#CompareImageLayers">CompareImageLayers</a> &bull; <a href="layer.html#DeconstructImages">DeconstructImages</a> &bull; <a href="layer.html#OptimizeImageLayers">OptimizeImageLayers</a> &bull; <a href="layer.html#OptimizeImagePlusLayers">OptimizeImagePlusLayers</a> &bull; <a href="layer.html#OptimizeImageTransparency">OptimizeImageTransparency</a> &bull; <a href="layer.html#RemoveDuplicateLayers">RemoveDuplicateLayers</a> &bull; <a href="layer.html#RemoveZeroDelayLayers">RemoveZeroDelayLayers</a> &bull; <a href="layer.html#CompositeLayers">CompositeLayers</a> &bull; <a href="layer.html#MergeImageLayers">MergeImageLayers</a>]</p>
cristy6f77f692011-02-15 15:31:39 +0000233
cristy20398432011-08-11 01:31:50 +0000234<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="CoalesceImages">CoalesceImages</a></h2>
235<div class="doc-section">
236
237<p>CoalesceImages() composites a set of images while respecting any page offsets and disposal methods. GIF, MIFF, and MNG animation sequences typically start with an image background and each subsequent image varies in size and offset. A new image sequence is returned with all images the same size as the first images virtual canvas and composited with the next image in the sequence.</p>
238
239<p>The format of the CoalesceImages method is:</p>
240
241<pre class="code">
242 Image *CoalesceImages(Image *image,ExceptionInfo *exception)
243</pre>
244
245<p>A description of each parameter follows:</p>
246
247<h5>image</h5>
248<p>the image sequence.</p>
249
250<h5>exception</h5>
251<p>return any errors or warnings in this structure.</p>
252
253 </div>
254<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="DisposeImages">DisposeImages</a></h2>
255<div class="doc-section">
256
257<p>DisposeImages() returns the coalesced frames of a GIF animation as it would appear after the GIF dispose method of that frame has been applied. That is it returned the appearance of each frame before the next is overlaid.</p>
258
259<p>The format of the DisposeImages method is:</p>
260
261<pre class="code">
262 Image *DisposeImages(Image *image,ExceptionInfo *exception)
263</pre>
264
265<p>A description of each parameter follows:</p>
266
267<h5>image</h5>
268<p>the image sequence.</p>
269
270<h5>exception</h5>
271<p>return any errors or warnings in this structure.</p>
272
273 </div>
274<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="CompareImageLayers">CompareImageLayers</a></h2>
275<div class="doc-section">
276
cristy72da67d2013-02-24 21:40:48 +0000277<p>CompareImageLayers() compares each image with the next in a sequence and returns the minimum bounding region of all the pixel differences (of the ImageLayerMethod specified) it discovers.</p>
cristy20398432011-08-11 01:31:50 +0000278
279<p>Images do NOT have to be the same size, though it is best that all the images are 'coalesced' (images are all the same size, on a flattened canvas, so as to represent exactly how an specific frame should look).</p>
280
281<p>No GIF dispose methods are applied, so GIF animations must be coalesced before applying this image operator to find differences to them.</p>
282
283<p>The format of the CompareImageLayers method is:</p>
284
285<pre class="code">
286 Image *CompareImageLayers(const Image *images,
cristy72da67d2013-02-24 21:40:48 +0000287 const ImageLayerMethod method,ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000288</pre>
289
290<p>A description of each parameter follows:</p>
291
292<h5>image</h5>
293<p>the image.</p>
294
295<h5>method</h5>
296<p>the layers type to compare images with. Must be one of... CompareAnyLayer, CompareClearLayer, CompareOverlayLayer.</p>
297
298<h5>exception</h5>
299<p>return any errors or warnings in this structure.</p>
300
301 </div>
302<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="DeconstructImages">DeconstructImages</a></h2>
303<div class="doc-section">
304
305<p>DeconstructImages() compares each image with the next in a sequence and returns the minimum bounding region of all differences from the first image.</p>
306
307<p>This function is deprecated in favor of the more universal CompareImageLayers() function.</p>
308
309<p>The format of the DeconstructImages method is:</p>
310
311<pre class="code">
312 Image *DeconstructImages(const Image *images, ExceptionInfo *exception)
313</pre>
314
315<p>A description of each parameter follows:</p>
316
317<h5>image</h5>
318<p>the image.</p>
319
320<h5>exception</h5>
321<p>return any errors or warnings in this structure.</p>
322
323 </div>
324<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="OptimizeImageLayers">OptimizeImageLayers</a></h2>
325<div class="doc-section">
326
327<p>OptimizeImageLayers() compares each image the GIF disposed forms of the previous image in the sequence. From this it attempts to select the smallest cropped image to replace each frame, while preserving the results of the GIF animation.</p>
328
329<p>The format of the OptimizeImageLayers method is:</p>
330
331<pre class="code">
332 Image *OptimizeImageLayers(const Image *image,
333 ExceptionInfo *exception)
334</pre>
335
336<p>A description of each parameter follows:</p>
337
338<h5>image</h5>
339<p>the image.</p>
340
341<h5>exception</h5>
342<p>return any errors or warnings in this structure.</p>
343
344 </div>
345<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="OptimizeImagePlusLayers">OptimizeImagePlusLayers</a></h2>
346<div class="doc-section">
347
348<p>OptimizeImagePlusLayers() is exactly as OptimizeImageLayers(), but may also add or even remove extra frames in the animation, if it improves the total number of pixels in the resulting GIF animation.</p>
349
350<p>The format of the OptimizePlusImageLayers method is:</p>
351
352<pre class="code">
353 Image *OptimizePlusImageLayers(const Image *image,
354 ExceptionInfo *exception)
355</pre>
356
357<p>A description of each parameter follows:</p>
358
359<h5>image</h5>
360<p>the image.</p>
361
362<h5>exception</h5>
363<p>return any errors or warnings in this structure.</p>
364
365 </div>
366<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="OptimizeImageTransparency">OptimizeImageTransparency</a></h2>
367<div class="doc-section">
368
369<p>OptimizeImageTransparency() takes a frame optimized GIF animation, and compares the overlayed pixels against the disposal image resulting from all the previous frames in the animation. Any pixel that does not change the disposal image (and thus does not effect the outcome of an overlay) is made transparent.</p>
370
371<p>WARNING: This modifies the current images directly, rather than generate a new image sequence.</p>
372
373<p>The format of the OptimizeImageTransperency method is:</p>
374
375<pre class="code">
376 void OptimizeImageTransperency(Image *image,ExceptionInfo *exception)
377</pre>
378
379<p>A description of each parameter follows:</p>
380
381<h5>image</h5>
382<p>the image sequence</p>
383
384<h5>exception</h5>
385<p>return any errors or warnings in this structure.</p>
386
387 </div>
388<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="RemoveDuplicateLayers">RemoveDuplicateLayers</a></h2>
389<div class="doc-section">
390
391<p>RemoveDuplicateLayers() removes any image that is exactly the same as the next image in the given image list. Image size and virtual canvas offset must also match, though not the virtual canvas size itself.</p>
392
393<p>No check is made with regards to image disposal setting, though it is the dispose setting of later image that is kept. Also any time delays are also added together. As such coalesced image animations should still produce the same result, though with duplicte frames merged into a single frame.</p>
394
395<p>The format of the RemoveDuplicateLayers method is:</p>
396
397<pre class="code">
398 void RemoveDuplicateLayers(Image **image, ExceptionInfo *exception)
399</pre>
400
401<p>A description of each parameter follows:</p>
402
403<h5>images</h5>
404<p>the image list</p>
405
406<h5>exception</h5>
407<p>return any errors or warnings in this structure.</p>
408
409 </div>
410<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="RemoveZeroDelayLayers">RemoveZeroDelayLayers</a></h2>
411<div class="doc-section">
412
413<p>RemoveZeroDelayLayers() removes any image that as a zero delay time. Such images generally represent intermediate or partial updates in GIF animations used for file optimization. They are not ment to be displayed to users of the animation. Viewable images in an animation should have a time delay of 3 or more centi-seconds (hundredths of a second).</p>
414
415<p>However if all the frames have a zero time delay, then either the animation is as yet incomplete, or it is not a GIF animation. This a non-sensible situation, so no image will be removed and a 'Zero Time Animation' warning (exception) given.</p>
416
417<p>No warning will be given if no image was removed because all images had an appropriate non-zero time delay set.</p>
418
419<p>Due to the special requirements of GIF disposal handling, GIF animations should be coalesced first, before calling this function, though that is not a requirement.</p>
420
421<p>The format of the RemoveZeroDelayLayers method is:</p>
422
423<pre class="code">
424 void RemoveZeroDelayLayers(Image **image, ExceptionInfo *exception)
425</pre>
426
427<p>A description of each parameter follows:</p>
428
429<h5>images</h5>
430<p>the image list</p>
431
432<h5>exception</h5>
433<p>return any errors or warnings in this structure.</p>
434
435 </div>
436<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="CompositeLayers">CompositeLayers</a></h2>
437<div class="doc-section">
438
cristy751980d2012-06-03 23:18:35 +0000439<p>CompositeLayers() compose the source image sequence over the destination image sequence, starting with the current image in both lists.</p>
cristy20398432011-08-11 01:31:50 +0000440
cristy751980d2012-06-03 23:18:35 +0000441<p>Each layer from the two image lists are composted together until the end of one of the image lists is reached. The offset of each composition is also adjusted to match the virtual canvas offsets of each layer. As such the given offset is relative to the virtual canvas, and not the actual image.</p>
cristy20398432011-08-11 01:31:50 +0000442
cristy751980d2012-06-03 23:18:35 +0000443<p>Composition uses given x and y offsets, as the 'origin' location of the source images virtual canvas (not the real image) allowing you to compose a list of 'layer images' into the destiantioni images. This makes it well sutiable for directly composing 'Clears Frame Animations' or 'Coaleased Animations' onto a static or other 'Coaleased Animation' destination image list. GIF disposal handling is not looked at.</p>
cristy20398432011-08-11 01:31:50 +0000444
cristy751980d2012-06-03 23:18:35 +0000445<p>Special case:- If one of the image sequences is the last image (just a single image remaining), that image is repeatally composed with all the images in the other image list. Either the source or destination lists may be the single image, for this situation.</p>
cristy20398432011-08-11 01:31:50 +0000446
cristy751980d2012-06-03 23:18:35 +0000447<p>In the case of a single destination image (or last image given), that image will ve cloned to match the number of images remaining in the source image list.</p>
448
449<p>This is equivelent to the "-layer Composite" Shell API operator.</p>
450
cristy20398432011-08-11 01:31:50 +0000451
452<p>The format of the CompositeLayers method is:</p>
453
454<pre class="code">
455 void CompositeLayers(Image *destination,
456 const CompositeOperator compose, Image *source,
457 const ssize_t x_offset, const ssize_t y_offset,
458 ExceptionInfo *exception);
459</pre>
460
461<p>A description of each parameter follows:</p>
462
463<h5>destination</h5>
464<p>the destination images and results</p>
465
466<h5>source</h5>
467<p>source image(s) for the layer composition</p>
468
469<h5>compose, x_offset, y_offset</h5>
470<p>arguments passed on to CompositeImages()</p>
471
472<h5>exception</h5>
473<p>return any errors or warnings in this structure.</p>
474
475 </div>
476<h2><a href="http://www.imagemagick.org/api/MagickCore/layer_8c.html" id="MergeImageLayers">MergeImageLayers</a></h2>
477<div class="doc-section">
478
479<p>MergeImageLayers() composes all the image layers from the current given image onward to produce a single image of the merged layers.</p>
480
cristy72da67d2013-02-24 21:40:48 +0000481<p>The inital canvas's size depends on the given ImageLayerMethod, and is initialized using the first images background color. The images are then compositied onto that image in sequence using the given composition that has been assigned to each individual image.</p>
cristy20398432011-08-11 01:31:50 +0000482
483<p>The format of the MergeImageLayers is:</p>
484
485<pre class="text">
486 Image *MergeImageLayers(const Image *image,
cristy72da67d2013-02-24 21:40:48 +0000487 const ImageLayerMethod method, ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000488</pre>
489
490<p>A description of each parameter follows:</p>
491
492<h5>image</h5>
493<p>the image list to be composited together</p>
494
495<h5>method</h5>
496<p>the method of selecting the size of the initial canvas.</p>
497
498<p>MergeLayer: Merge all layers onto a canvas just large enough to hold all the actual images. The virtual canvas of the first image is preserved but otherwise ignored.</p>
499
500<p>FlattenLayer: Use the virtual canvas size of first image. Images which fall outside this canvas is clipped. This can be used to 'fill out' a given virtual canvas.</p>
501
502<p>MosaicLayer: Start with the virtual canvas of the first image, enlarging left and right edges to contain all images. Images with negative offsets will be clipped.</p>
503
504<p>TrimBoundsLayer: Determine the overall bounds of all the image layers just as in "MergeLayer", then adjust the the canvas and offsets to be relative to those bounds, without overlaying the images.</p>
505
506<p>WARNING: a new image is not returned, the original image sequence page data is modified instead.</p>
507
508<h5>exception</h5>
509<p>return any errors or warnings in this structure.</p>
510
511 </div>
cristy06f63f22012-10-31 00:50:07 +0000512
513</div>
514
515<div id="linkbar">
516 <span id="linkbar-west">&nbsp;</span>
517 <span id="linkbar-center">
cristy72da67d2013-02-24 21:40:48 +0000518 <a href="../../discourse-server">Discourse Server</a> &bull;
cristy06f63f22012-10-31 00:50:07 +0000519 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>
520 </span>
521 <span id="linkbar-east">&nbsp;</span>
522 </div>
523 <div class="footer">
cristy72da67d2013-02-24 21:40:48 +0000524 <span id="footer-west">&copy; 1999-2011 ImageMagick Studio LLC</span>
cristyd8833bf2013-02-24 22:14:53 +0000525 <span id="footer-east"> <a href="../../www/contact.html">Contact the Wizards</a></span>
cristy06f63f22012-10-31 00:50:07 +0000526 </div>
527 <div style="clear: both; margin: 0; width: 100%; "></div>
528 <script type="text/javascript">
529 var _gaq = _gaq || [];
530 _gaq.push(['_setAccount', 'UA-17690367-1']);
531 _gaq.push(['_trackPageview']);
532
533 (function() {
cristy18b955e2013-02-24 21:06:33 +0000534 var ga = document.createElement('offline-script'); ga.type = 'text/javascript'; ga.async = true;
cristy06f63f22012-10-31 00:50:07 +0000535 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
cristy18b955e2013-02-24 21:06:33 +0000536 var s = document.getElementsByTagName('offline-script')[0]; s.parentNode.insertBefore(ga, s);
cristy06f63f22012-10-31 00:50:07 +0000537 })();
538 </script>
539</body>
540</html>