Working with channels

Jul 5, 2013 at 5:31 PM
Edited Jul 7, 2013 at 6:16 PM
What is the proper way of working with channels in Magick.Net?
How to do this:

Image Magick Command-line examples
separate RGB channels and write channels to file
workingDir > convert imageRGB.jpg –separate imageCh_%d.jpg
recombine channels to create RGB image
workingDir > convert imageCh_0.jpg imageCh_1.jpg imageCh_2.jpg –combine newImageRGB.jpg
Version: Magick.NET Q16 x64 net40-client
Jul 6, 2013 at 9:19 PM
This is currently not possible with Magick.NET. I will create a work item to add these methods and post an example after the next release.
Jul 6, 2013 at 9:21 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 7, 2013 at 3:43 AM
Thanks, it’s a great project. Good job!
Jul 7, 2013 at 3:43 AM
Maybe it’s part of the work needed to be done but in my version “Magick.NET Q16 x64 net40-client” in order to get the R,G,B channels (I guess) I need to create 3 copy of the image which can be memory intense for large images.
Jul 7, 2013 at 9:43 AM
Edited Jul 7, 2013 at 11:17 AM
The Separate method in Magick.NET returns an IEnumerable<MagickImage>. It no longer modifies the current image. Below is an example:
using (MagickImage image = new MagickImage("imageRGB.jpg"))
  int i = 0;
  foreach (MagickImage channel in image.Separate(Channels.RGB))
    channel.Write("imageCh_" + i + ".jpg");

using (MagickImageCollection collection = new MagickImageCollection())
  using (MagickImage image = collection.Combine())
Jul 7, 2013 at 6:17 PM
I just repeat myself, great project!
Jul 7, 2013 at 6:56 PM
Feel free to donate :P