<?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.adaptiveresizeimage.php',
    1 => 'Imagick::adaptiveResizeImage',
    2 => 'Adaptively resize image with data dependent triangulation',
  ),
  'up' => 
  array (
    0 => 'class.imagick.php',
    1 => 'Imagick',
  ),
  'prev' => 
  array (
    0 => 'imagick.adaptiveblurimage.php',
    1 => 'Imagick::adaptiveBlurImage',
  ),
  'next' => 
  array (
    0 => 'imagick.adaptivesharpenimage.php',
    1 => 'Imagick::adaptiveSharpenImage',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/imagick/imagick/adaptiveresizeimage.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="imagick.adaptiveresizeimage" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Imagick::adaptiveResizeImage</h1>
  <p class="verinfo">(PECL imagick 2, PECL imagick 3)</p><p class="refpurpose"><span class="refname">Imagick::adaptiveResizeImage</span> &mdash; <span class="dc-title">Adaptively resize image with data dependent triangulation</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-imagick.adaptiveresizeimage-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">function</span> <span class="methodname"><strong>Imagick::adaptiveResizeImage</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$columns</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$rows</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$bestfit</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$legacy</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Adaptively resize image with data-dependent triangulation. Avoids
   blurring across sharp color changes. Most useful when used to shrink
   images slightly to a slightly smaller &quot;web size&quot;; may not look good
   when a full-sized image is adaptively resized to a thumbnail.
   此方法在Imagick基于ImageMagick 6.2.9以上版本编译时可用。
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
<p class="simpara">
 参数 <code class="parameter">bestfit</code> 的特性在 Imagick 3.0.0 中已改变。在此版本以前，当目标尺寸设为
 400x400 时，原尺寸为 200x150 的图像将不会被改变。自 Imagick 3.0.0
 起，源图像将会被放大到 400x300 因为这将更好的适合目标尺寸。当使用参数
 <code class="parameter">bestfit</code> 时，必须同时给出宽度和高度。
</p>
</p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-imagick.adaptiveresizeimage-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">columns</code></dt>
     <dd>
      <p class="para">
       The number of columns in the scaled image.
      </p>
     </dd>
    
    
     <dt><code class="parameter">rows</code></dt>
     <dd>
      <p class="para">
       The number of rows in the scaled image.
      </p>
     </dd>
    
    
     <dt><code class="parameter">bestfit</code></dt>
     <dd>
      <p class="simpara">
       Whether to fit the image within the given dimensions while preserving
       the aspect ratio.
      </p>
     </dd>
    
    
     <dt><code class="parameter">legacy</code></dt>
     <dd>
      <p class="simpara">
       Optional <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> parameter.
       If set to true, the calculations are done with the small rounding bug
       that existed in Imagick before 3.4.0. If set to false, the calculations
       should produce the same results as the ImageMagick command-line tools.
      </p>
     </dd>
    
   </dl>
  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-imagick.adaptiveresizeimage-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.adaptiveresizeimage-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   错误时抛出 ImagickException。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-imagick.adaptiveresizeimage-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>PECL imagick 2.1.0</td>
      <td>Added optional fit parameter.</td>
     </tr>

     <tr>
      <td>PECL imagick 2.1.0</td>
      <td>
      This method now supports proportional scaling.
      Pass zero as either parameter for proportional scaling.
      </td>
     </tr>

     <tr>
      <td>PECL imagick 3.4.0</td>
      <td>
       Added the <code class="parameter">legacy</code> parameter.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-imagick.adaptiveresizeimage-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 Using <span class="function"><strong>Imagick::adaptiveResizeImage()</strong></span></strong></p>
    <div class="example-contents"><p>
     Resize an image to a standard size for the web.  This method works best
     when resizing to a size only slightly smaller than the previous image
     size.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type: image/jpeg'</span><span style="color: #007700">);

</span><span style="color: #0000BB">$image </span><span style="color: #007700">= new </span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #DD0000">'image.jpg'</span><span style="color: #007700">);
</span><span style="color: #0000BB">$image</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">adaptiveResizeImage</span><span style="color: #007700">(</span><span style="color: #0000BB">1024</span><span style="color: #007700">,</span><span style="color: #0000BB">768</span><span style="color: #007700">);

echo </span><span style="color: #0000BB">$image</span><span style="color: #007700">;
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
    </div>

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


 <div class="refsect1 seealso" id="refsect1-imagick.adaptiveresizeimage-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="imagick.chopimage.php" class="function" rel="rdfs-seeAlso">Imagick::chopImage()</a> - Removes a region of an image and trims</span></li>
    <li><span class="function"><a href="imagick.cropimage.php" class="function" rel="rdfs-seeAlso">Imagick::cropImage()</a> - 截图图片的一块区域</span></li>
    <li><span class="function"><a href="imagick.magnifyimage.php" class="function" rel="rdfs-seeAlso">Imagick::magnifyImage()</a> - Scales an image proportionally 2x</span></li>
    <li><span class="function"><a href="imagick.minifyimage.php" class="function" rel="rdfs-seeAlso">Imagick::minifyImage()</a> - Scales an image proportionally to half its size</span></li>
    <li><span class="function"><a href="imagick.resizeimage.php" class="function" rel="rdfs-seeAlso">Imagick::resizeImage()</a> - Scales an image</span></li>
    <li><span class="function"><a href="imagick.scaleimage.php" class="function" rel="rdfs-seeAlso">Imagick::scaleImage()</a> - Scales the size of an image</span></li>
    <li><span class="function"><a href="imagick.shaveimage.php" class="function" rel="rdfs-seeAlso">Imagick::shaveImage()</a> - Shaves pixels from the image edges</span></li>
    <li><span class="function"><a href="imagick.thumbnailimage.php" class="function" rel="rdfs-seeAlso">Imagick::thumbnailImage()</a> - Changes the size of an image</span></li>
    <li><span class="function"><a href="imagick.trimimage.php" class="function" rel="rdfs-seeAlso">Imagick::trimImage()</a> - Remove edges from the image</span></li>
   </ul>
  </p>
 </div>


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