<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.imagick.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'imagick.optimizeimagelayers.php',
    1 => 'Imagick::optimizeImageLayers',
    2 => 'Removes repeated portions of images to optimize',
  ),
  'up' => 
  array (
    0 => 'class.imagick.php',
    1 => 'Imagick',
  ),
  'prev' => 
  array (
    0 => 'imagick.opaquepaintimage.php',
    1 => 'Imagick::opaquePaintImage',
  ),
  'next' => 
  array (
    0 => 'imagick.orderedposterizeimage.php',
    1 => 'Imagick::orderedPosterizeImage',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/imagick/imagick/optimizeimagelayers.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="imagick.optimizeimagelayers" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Imagick::optimizeImageLayers</h1>
  <p class="verinfo">(PECL imagick 2, PECL imagick 3)</p><p class="refpurpose"><span class="refname">Imagick::optimizeImageLayers</span> &mdash; <span class="dc-title">Removes repeated portions of images to optimize</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-imagick.optimizeimagelayers-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Imagick::optimizeImageLayers</strong></span>(): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>


  <p class="para rdfs-comment">
   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 animation. 
   此方法在Imagick基于ImageMagick 6.2.9以上版本编译时可用。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-imagick.optimizeimagelayers-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-imagick.optimizeimagelayers-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-imagick.optimizeimagelayers-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   错误时抛出 ImagickException。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-imagick.optimizeimagelayers-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 Using <span class="function"><strong>Imagick::optimizeImageLayers()</strong></span></strong></p>
    <div class="example-contents"><p>
      Reading, optimizing and writing a GIF image
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/* create new imagick object */<br /></span><span style="color: #0000BB">$im </span><span style="color: #007700">= new </span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #DD0000">"test.gif"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* optimize the image layers */<br /></span><span style="color: #0000BB">$im</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">optimizeImageLayers</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/* write the image back */<br /></span><span style="color: #0000BB">$im</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">writeImages</span><span style="color: #007700">(</span><span style="color: #DD0000">"test_optimized.gif"</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-imagick.optimizeimagelayers-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="imagick.compareimagelayers.php" class="function" rel="rdfs-seeAlso">Imagick::compareImageLayers()</a> - Returns the maximum bounding region between images</span></li>
    <li><span class="function"><a href="imagick.writeimages.php" class="function" rel="rdfs-seeAlso">Imagick::writeImages()</a> - Writes an image or image sequence</span></li>
    <li><span class="function"><a href="imagick.writeimage.php" class="function" rel="rdfs-seeAlso">Imagick::writeImage()</a> - 把图片写入指定的文件</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>