PHP Imagick-“量化透明"相等的 [英] PHP Imagick - "-quantize transparent" equivalent

查看:129
本文介绍了PHP Imagick-“量化透明"相等的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有与-quantize transparent相对应的PHP Imagick ???

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

-量化透明用法示例注意:在内部使用-透明化"搜索页面

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

推荐答案

量化受PHP的Imagick扩展支持;但是,几乎没有文件编写.幸运的是,"颜色量化和透明度"中的示例很简单.

Quantize 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

从此示例中,我们可以确定Imagick::quantizeImage()所需的5个参数.

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

  • 颜色数= 15(-颜色15 )
  • 颜色空间=透明
  • 树深= 0(未定义)
  • Dither = False( + dither )
  • 测量错误= False
  • 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");

这篇关于PHP Imagick-“量化透明"相等的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆