[英]How to get RGB channel using Wand?
I want to get a channel (Red, for example) from an Image using Wand in Python.我想在 Python 中使用 Wand 从图像中获取通道(例如红色)。
I already know how to get channel using ImageMagick itself but I want to do the same but using Wand我已经知道如何使用 ImageMagick 本身获取频道,但我想做同样的事情,但使用 Wand
It seems to me that it is not implemented in Wand, or I miss something?在我看来它没有在 Wand 中实现,或者我错过了什么?
It seems to me that it is not implemented in Wand, or I miss something?
在我看来它没有在 Wand 中实现,或者我错过了什么?
This was implemented in Wand version 0.3.0, but not well documented.这是在 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')
Found a workaround using color_matrix
:找到了一个使用
color_matrix
的解决方法:
img.color_matrix([
[1, 0, 0],
[1, 0, 0],
[1, 0, 0],
])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.