本文介绍了在构造ImagickPixel时设置alpha通道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用ImageMagick的新手。我正在使用PHP的最新imagick扩展(3.1.0rc1)。然而,想象力的文档似乎有些稀疏。

I am new to using ImageMagick. I am using the latest imagick extension (3.1.0rc1) with PHP. However, the documentation for imagick seems to be somewhat sparse.

我想创建一个对象。 指出这些是传递给构造函数的一些有效颜色值:blue,#0000ff,rgb(0,0,255),cmyk(100,100,100,10)等

I want to create an ImagickPixel object with an alpha channel. The documentation states that these are some valid color values to pass to the constructor: "blue", "#0000ff", "rgb(0,0,255)", "cmyk(100,100,100,10)", etc.

我知道可以使用 getColorValue(imagick :: COLOR_ALPHA)来回溯ImagickPixel的alpha值;

那么,如何在对象初始化期间通过传递给构造函数来设置带alpha通道的rgb颜色?

So, how can I set an rgb color with an alpha channel during initialization of the object by passing to the constructor?

推荐答案

看起来这样做就是使用rgba:

Looks like the way to do it is to just use rgba:

$myImagickPixel = new ImagickPixel("rgba(250,15,150,0)"); //Where the last digit is the alpha and 0 is transparent and 1 is fully opaque.

这篇关于在构造ImagickPixel时设置alpha通道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-10 18:24