This project has moved and is read-only. For the latest updates, please go here.

Working with channels

Jul 5, 2013 at 6:31 PM
Edited Jul 7, 2013 at 7: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 10: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 10: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 4:43 AM
Thanks, it’s a great project. Good job!
Jul 7, 2013 at 4: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 10:43 AM
Edited Jul 7, 2013 at 12:17 PM
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 7:17 PM
I just repeat myself, great project!
Jul 7, 2013 at 7:56 PM
Feel free to donate :P