3

Is it possible to convert an image from the Grayscale color space into a RGB using Magick.NET?

If it is, what has to be done? I've tried something like this:

image.Format = MagickFormat.Png;
image.ColorSpace = ImageMagick.ColorSpace.sRGB;

When setting values for Format and ColorSpace respectively everything persist in memory, but once Write method is called it all gets reverted to its original values.

I'm wondering if it is needed to perform any transformation or something along these lines, as for example when converting CMYK to RGB one has to do something like this:

image.TransformColorSpace(ImageMagick.ColorProfile.USWebCoatedSWOP, ImageMagick.ColorProfile.SRGB);

It looks to me I'm missing something obvious, but it's hard to find much out there about this subject.

Nesaje
  • 595
  • 2
  • 18
  • What is the format of your output image? Is it PNG? – dlemstra Aug 13 '16 at 21:28
  • We are targeting PNG, JPG and GIF. In the example above it was PNG. Resulting ColorSpace is the same for PNG and JPG, being Grayscale, and Indexed for GIF whether we open output image again using Magick.NET or Photoshop for example. Thank you for taking a look. – Nesaje Aug 14 '16 at 10:06

0 Answers0