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);
Is there a way to use WIA for compression, or how else could I save the image using compression?
EDIT:
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);
After you have gotten your WIA Image (shown here as the 'image' variable), you apply a filter to adjust quality, before saving, like so:
In this example, jpgQuality is an int value between 1 and 100. 1 = low quality, 100 = best.
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