Page 1 of 1

Combine the three images into one as the RGB channels.

Posted: 2017-01-11T16:26:47-07:00
by redline16
There are three grayscale image, if they can be combined into a single image as the red, green and blue channels using Magick.NET not byte by byte?
In advance I apologize if my question silly, or the answer to him is obvious. :oops:

Re: Combine the three images into one as the RGB channels.

Posted: 2017-01-12T08:29:24-07:00
by dlemstra
Your question is not silly, my project lacks the proper amount of documentation. You can do that with the Combine method of the MagickImageCollection. Below is an example of how you could do that:

Code: Select all

using (MagickImageCollection images = new MagickImageCollection())
{
  images.Add(redImage);
  images.Add(greenImage);
  images.Add(blueImage);
  using (MagickImage image = images.Combine())
  {
    image.Write("image.png");
  }
}

Re: Combine the three images into one as the RGB channels.

Posted: 2017-01-12T10:28:33-07:00
by redline16
Thank you very much for the help. Everything worked out.
Only the final image was obtained with 2 layers (Cyan and Alpha). As I understand the settings of the final image is taken from the first images (original image grayscale). I changed it to sRGB and TrueColorAlpha and then it worked. It would be great if in the Combine could define the settings of the final image.
Anyway thank you very much for your help and your project.