保存扫描的图像 [英] save scanned image
本文介绍了保存扫描的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不使用保存文件"对话框的情况下使用Twainlib类将扫描的图像保存到本地路径.
谢谢
Tirupati
How to save scanned image Using Twainlib class to a local path without using Save file dialog box.
Thanks
Tirupati
推荐答案
使用文章:
.NET TWAIN图像扫描仪 [
Hi,
use the article :
.NET TWAIN image scanner[^]
and in the file GdiPlusLib.cs you can add the following method:
public static bool SaveDIB(IntPtr bminfo, IntPtr pixdat )
{
string FileName = "C:\\Test.bmp";
Guid clsid;
if (!GetCodecClsid(FileName, out clsid))
{
MessageBox.Show("Unknown picture format for extension " + Path.GetExtension(FileName), "Image Codec", MessageBoxButtons.OK, MessageBoxIcon.Information );
return false;
}
IntPtr img = IntPtr.Zero;
int st = GdipCreateBitmapFromGdiDib( bminfo, pixdat, ref img );
if( (st != 0) || (img == IntPtr.Zero) )
return false;
st = GdipSaveImageToFile(img, FileName, ref clsid, IntPtr.Zero);
GdipDisposeImage( img );
return st == 0;
}
调用此方法会将图像保存到硬编码文件C:\ Test.bmp.您可以修改此代码以适合您的需求.
Calling this method will save the image to the hardcoded file C:\Test.bmp. You can modify this code to fit your needs.
我不确定我是否理解您的问题.您为什么不能对路径进行硬编码?
I''m not sure that I understand your question. Why can''t you hard-code the path?
将此问题发布到文章的论坛(在页面底部):
.NET TWAIN图像扫描仪 [
Post this question in the article''s forum (at the bottom of the page):
.NET TWAIN image scanner[^]
Pay more attention to what you''re doing. There are plenty of notices that tell you want to do and how to do it on CodeProject.
这篇关于保存扫描的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文