Create and Save a Bitmap from an IntPtr c#

て烟熏妆下的殇ゞ 提交于 2019-12-12 04:34:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!