Quantcast
Channel: magick Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1011

Created Unassigned: Draw() causes single channel image to become quad channel [1411]

$
0
0
I have a grayscale image, upon which I'm writing a string. While the drawing happens correctly, as soon as the Draw() method is called - whether for text, a line, or anything else - the single channel grayscale becomes an RGBA image.

To diagnose, I called GetPixels().ToArray().Length before and after the Draw() call. The image is a 1029 x 1029 image.

Before: 1058841
After: 4235364

Sample code
```
image.ColorSpace = ColorSpace.Gray;
image.ColorType = ColorType.Grayscale;
Console.Write(image.GetPixels().ToArray().Length);
image.Settings.ColorType = ColorType.Grayscale;
image.Settings.FontFamily = "Lato";
image.Settings.TextGravity = Gravity.Center;
image.Draw(new Drawables().Text(0, 0, "Test"));
image.Draw(new DrawableLine(0, 0, 1029, 1029));
Console.Write(image.GetPixels().ToArray().Length));
```

Also, if I force it back to ColorSpace.Gray after all this code is called, the array returns: 2117682. Safe to assume this is an alpha channel included with the gray channel.

Viewing all articles
Browse latest Browse all 1011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>