繁体   English   中英

如何使用 Wand 获取 RGB 通道?

[英]How to get RGB channel using Wand?

我想在 Python 中使用 Wand 从图像中获取通道(例如红色)。

我已经知道如何使用 ImageMagick 本身获取频道,但我想做同样的事情,但使用 Wand

在我看来它没有在 Wand 中实现,或者我错过了什么?

在我看来它没有在 Wand 中实现,或者我错过了什么?

这是在 Wand 0.3.0 版中实现的,但没有很好的文档记录。

from wand.image import Image

with Image(filename='wizard:') as img:
    with img.channel_image['red'] as red_channel:
        red_channel.save(filename='red_channel.png')

red_channel

找到了一个使用color_matrix的解决方法:

img.color_matrix([
    [1, 0, 0],
    [1, 0, 0],
    [1, 0, 0],
])

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM