-1

I want to get a channel (Red, for example) from an Image using Wand in Python.

I already know how to get channel using ImageMagick itself but I want to do the same but using Wand

It seems to me that it is not implemented in Wand, or I miss something?

Crantisz
  • 227
  • 3
  • 13

2 Answers2

1

It seems to me that it is not implemented in Wand, or I miss something?

This was implemented in Wand version 0.3.0, but not well documented.

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

emcconville
  • 23,800
  • 4
  • 50
  • 66
0

Found a workaround using color_matrix :

img.color_matrix([
    [1, 0, 0],
    [1, 0, 0],
    [1, 0, 0],
])
Crantisz
  • 227
  • 3
  • 13