Page 1 of 1

How to set auto-grayscale off?

Posted: 2018-07-11T00:24:49-07:00
by 246246
According to this, viewtopic.php?f=3&t=34337, I have not yet find a way to accomplish to avoid RGB image (where all values are r=g=b) to be converted to grayscale. How to do it in Magick.NET?

Best Wishes,


PS
I do not want to use -type TrueColor, because the input might be indexed color whose all values are gray (r=g=b).
In that case, it should keep the Palette type.

Re: How to set auto-grayscale off?

Posted: 2018-07-11T01:00:15-07:00
by 246246
In the most recent Magick.NET 7.5.0.1, it seems

Code: Select all

using (var image = new MagickImage("c:/tmp/logo.tif"))
{
    image.SetAttribute("colorspace:auto-grayscale", "false");
    image.Write("c:/tmp/out.tif");
}
is working.

My first code was

Code: Select all

using (var image = new MagickImage("c:/tmp/logo.tif"))
{
    image.Settings.SetDefine("colorspace:auto-grayscale", "false");
    image.Write("c:/tmp/out.tif");
}
It does not work. Is my working code in the right way?