i am receving the byte pointer from c++ it holds the address of the image,i need to get the thumbnail from the byte pointer address is it possible?
What I have tried:
what I tried is after getting the address i marshall to convert the byte pointer into byte array then i pass the byte array to get the thumbnail then i will get the thumbnail. now the problem is when i have large size file in byte array while marshaling it takes time
to reduce this time without marshalling the byte pointer i need to get the thumbnail
my code is
byte[] managedArray = new byte[img.nsize];
Marshal.Copy(img.pBitmap, managedArray, 0, (int)img.nsize);
byte[] Temp1 = MakeThumbnail(managedArray, 200, 200);
public static byte[] MakeThumbnail(byte[] myImage, int thumbWidth, int thumbHeight)
{
using (MemoryStream ms = new MemoryStream())
using (Image thumbnail = Image.FromStream(new MemoryStream(myImage)).GetThumbnailImage(thumbWidth, thumbHeight, null, new IntPtr()))
{
thumbnail.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
return ms.ToArray();
}
}