Combine the three images into one as the RGB channels.

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
redline16
Posts: 2
Joined: 2017-01-11T16:19:10-07:00
Authentication code: 1151

Combine the three images into one as the RGB channels.

Post 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:
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post 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");
  }
}
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
redline16
Posts: 2
Joined: 2017-01-11T16:19:10-07:00
Authentication code: 1151

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

Post 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.
Post Reply