问题
In my application I scan an image from a TWAIN device, then, I need to save this image to a local disk. All I have is an IntPtr that references the image byte data array. How can I create a Bitmap object using the IntPtr value? I tried with:
Bitmap _img = new Bitmap(2450, 2450, 2452, PixelFormat.Format8bppIndexed, pixptr);
_img.Save("c:\\1.Jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
This saves the image, but the image is never the same as I scanned. Any help?
来源:https://stackoverflow.com/questions/18766722/create-and-save-a-bitmap-from-an-intptr-c-sharp