Page 1 of 1

How to create MagickImage from a pixel array

Posted: 2018-07-13T17:02:06-07:00
by Hong
I am sorry for this rudimentary question. I am new to ImageMagick.

Here is my code:

Code: Select all

MagickReadSettings mr = new MagickReadSettings();
mr.ColorType = ColorType.TrueColor;
mr.Width = iWidth;
mr.Height = 1;
var image = new MagickImage(abPixels, mr);
abPixels is iWidth*1*3 byte array (i.e. three bytes for each pixel). The last line throws the following exception:
no decode delegate for this image format `' @ error/blob.c/BlobToImage/456

Could anyone offer a tip on this?

Re: How to create MagickImage from a pixel array

Posted: 2018-07-14T00:48:06-07:00
by dlemstra
You should set mr.Format to MagickFormat.Rgb but that will only work when you use the Q8 version of Magick.NET. Otherwise you should change the byte array to an ushort array (Q16) or float array (Q16-HDRI) first.

Re: How to create MagickImage from a pixel array

Posted: 2018-07-14T03:53:02-07:00
by Hong
Thanks a lot. I apparently installed a wrong package. More importantly, I could not find the documentation that is right there as the first folder of the github home page of Magick.NET.
All clear now.