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 » 2019-01-21T07:28:46-07:00

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: 1555
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Loading monochrome pixel into MagickImage

Post by dlemstra » 2019-01-21T11:08:08-07:00

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 » 2019-01-22T03:48:27-07:00

Thanks dlemstra :D
Your solution works.

Post Reply