WIA:保存文件时无压缩 [英] WIA: no compression when saving files
本文介绍了WIA:保存文件时无压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用WIA扫描图像并注意到,图像没有有效地存储 SaveFile
显然没有使用压缩。
I'm using WIA for scanning images and noticed, that images aren't stored efficiently as SaveFile
apparently doesn't make use of compression.
目前我正在使用此代码:
Currently I'm using this code:
WIA.ImageFile img = (WIA.ImageFile)item.Transfer(WIA.FormatID.wiaFormatPNG);
img.SaveFile(path);
有没有办法使用WIA压缩,或者如何使用压缩保存图像?
Is there a way to use WIA for compression, or how else could I save the image using compression?
编辑:
使用以下代码我可以减小文件大小从25到10 MB。
Using the following code I was able to decrease file size from 25 to 10 MB.
WIA.ImageFile img = (WIA.ImageFile)item.Transfer(WIA.FormatID.wiaFormatPNG);
WIA.ImageProcess ImageProcess1 = new WIA.ImageProcessClass();
System.Object Object1 = null;
System.Object Object2 = null;
Object1 = (Object)"Convert";
ImageProcess1.Filters.Add(ImageProcess1.FilterInfos.get_Item(ref Object1).FilterID, 0);
Object1 = (Object)"FormatID";
Object2 = (Object)WIA.FormatID.wiaFormatPNG;
ImageProcess1.Filters[1].Properties.get_Item(ref Object1).set_Value(ref Object2);
img = ImageProcess1.Apply(img);
img.SaveFile(path);
推荐答案
基本上你应该先添加一个压缩过滤器,图片,在此网址中,您可以找到tiff / jpg压缩的示例:
Basically you should add a compression filter before you save your image, in this url you can find a sample of tiff/jpg compression:
http://www.debugging.com/bug/18157
这篇关于WIA:保存文件时无压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文