问题
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