This project has moved. For the latest updates, please go here.

Ushort Array Channels from WritablePixelCollection

Jul 7, 2013 at 3:48 AM
Edited Jul 7, 2013 at 6:32 PM
I fetch the UInt16 array from WritablePixelCollection:
WritablePixelCollection pixels = magickImg.GetWritablePixels();
UInt16[] pixelArray = pixels.GetValues();
My image is a 16-bit grayscale so I expect the array will contain one channel but it hold R,G,B,A channels with repeated grayscale values(except the alpha channel that’s 0). Maybe it’s normal (for example the core handle every image as RGBA) and not a big problem but large grayscale images can consume a lot of resource.

Magick.NET Version: Q16 x64 net40-client
Jul 7, 2013 at 9:41 AM
That is how ImageMagick works internally but this will change in ImageMagick 7. In the porting guide ( the following is written:
Grayscale images consume one pixel channel in ImageMagick version 7. To process RGB, set the colorspace to RGB (e.g. -colorspace rgb).
Jul 7, 2013 at 6:18 PM
Ok I understand now.