Hi All,
I am pretty new to bitmap manipulations. I have a byte array and i need a bitmap out of that. I am using the below code to get the bitmap.
if (imgByte != null)
{
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat);
Marshal.Copy(imgByte, 0, bmpData.Scan0, ImageHeight * (int)lngPitch);
bmp.UnlockBits(bmpData);
}
But it is taking too much CPU usage. I know the performance can be enhanced by using the unsafe code. Can anyone please help me or give me the code to enhance the byte array manipulation to construct a bitmap.
Any help is highly appreciated.
Thanks