Loading monochrome pixel into MagickImage

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
knr
Posts: 8
Joined: 2019-01-21T02:57:04-07:00
Authentication code: 1152

Loading monochrome pixel into MagickImage

Post by knr »

I kan load/read a raw RGB pixel array into a MagickImage.

Code: Select all

PixelStorageSettings pixelStorageSettings = new PixelStorageSettings(100, 100, StorageType.Short, PixelMapping.BGR);
var colorImage = new MagickImage(myImageDataByteArray, pixelStorageSettings);
How do I load/read a monochrome pixel data? PixelMapping type only support color images.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Loading monochrome pixel into MagickImage

Post by dlemstra »

You should use the `string` overload instead.

Code: Select all

new PixelStorageSettings(100, 100, StorageType.Short,"R")
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
knr
Posts: 8
Joined: 2019-01-21T02:57:04-07:00
Authentication code: 1152

Re: Loading monochrome pixel into MagickImage

Post by knr »

Thanks dlemstra :D
Your solution works.
Post Reply