PHP Imagick - “-quantize transparent” equivalent

风格不统一 提交于 2019-12-11 01:09:54

问题


Is there a PHP Imagick equivalent for -quantize transparent ???

-quantize transparent usage example note: seach for '-quantize transparent' within page


回答1:


Qunatize is supported by PHP's Imagick extension; however, little documentation has been authored. Luckily, the example from "Color Quantization and Transparency" is straightforward.

convert alpha_gradient.png -quantize transparent \
    +dither  -colors 15   alpha_colors_15qt.png

From this example, we can determine the 5 arguments needed by Imagick::quantizeImage

  • Number of colors = 15 (-colors 15)
  • Colorspace = transparent
  • Tree depth = 0 (undefined)
  • Dither = False (+dither)
  • Messure errors = False
<?php

$wand = new Imagick("alpha_gradient.png");
$wand->quantizeImage(15,Imagick::COLORSPACE_TRANSPARENT,0,false,false);
$wand->writeImage("alpha_colors_15qt.png");


来源:https://stackoverflow.com/questions/13327675/php-imagick-quantize-transparent-equivalent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!