【问题标题】:How to extract alpha and other channels from a PNG file with PHP Gmagick?如何使用 PHP Gmagick 从 PNG 文件中提取 alpha 和其他通道?
【发布时间】:2011-09-20 13:04:36
【问题描述】:

我正在尝试将 2 个图形魔法命令移植到 Gmagick php library(注意:不是 Imagick)。 命令是:

  1. gm convert -matte -flatten image.png output.png
  2. gm convert -channel Matte -negate image.png output.png

基本上,我试图将透明 png 中的 alpha 通道提取到它自己的文件中,并将没有 alpha 的图像从 php 脚本中提取到另一个文件中。

我已经拥有 Imagick 等价物,但我对 Gmagick 很感兴趣。

任何想法,任何人?

【问题讨论】:

    标签: php png imagick graphicsmagick gmagick


    【解决方案1】:

    您可以使用Gmagick::separateimagechannel获取频道(获取the matte channel的号码)。关于去除哑光通道,我不知道,但应该可以。

    【讨论】:

    • 我认为可以通过分离所有通道但 alpha 来实现。但是 -negate 命令没有记录在 php 文档中......知道如何用 gmagick 否定图像吗?
    • negate 命令有什么作用?反转图片?异或吗?
    • 来自 gm 手册页:-negate 用互补色替换每个像素图像的红色、绿色和蓝色强度被否定。白色变成黑色,黄色变成蓝色,等等。
    猜你喜欢
    • 2011-08-22
    • 2016-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-21
    • 1970-01-01
    • 2019-03-18
    相关资源
    最近更新 更多