wrong Depth with png format

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
User avatar
Flauzer
Posts: 1
Joined: 2016-03-25T13:46:22-07:00
Authentication code: 1151

wrong Depth with png format

Post by Flauzer » 2016-03-25T14:20:53-07:00

Hi,
I can't convert a jpg image to png, grayscale and 8 bit depth.

Code: Select all


// read from disk...

image.Format = MagickFormat.Png;
...
image.ColorType = ColorType.Grayscale;
image.Depth = 8;
image.Write(FullPathFile);
The result is always 24 bit depth...
I've lost something? where is my mistake? bug?

It seems this https://www.imagemagick.org/discourse-s ... hp?t=27766

Thanks in advance

EDIT.
workaround: ...change image.Format in MagickFormat.Png8.

User avatar
dlemstra
Posts: 1569
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: wrong Depth with png format

Post by dlemstra » 2016-03-28T02:50:58-07:00

Setting image.Format to MagickFormat.Png8 is not a workaround. This is how you tell the png writer that you want an 8 bit image.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Post Reply