Re: Windows Image Acquisition library problems

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



This is how I am doing it...

WIA.ImageProcess ImageProcess1 = new WIA.ImageProcess();

Object Ob1 = null;
Object Ob2 = null;

Ob1 = (Object)"Convert";
ImageProcess1.Filters.Add(ImageProcess1.FilterInfos.get_Item(ref
Ob1).FilterID, 0);

Ob1 = (Object)"FormatID";
Ob2 = (Object)WIA.FormatID.wiaFormatJPEG;
ImageProcess1.Filters[1].Properties.get_Item(ref
Ob1).set_Value(ref Ob2);

Ob1 = (Object)"Quality";
Ob2 = ScanQuality;
ImageProcess1.Filters[1].Properties.get_Item(ref
Ob1).set_Value(ref Ob2);

Ob1 = null;
Ob2 = null;

The ScanQuality is a setting I have stored in my app.config file. It is a
value between 1 and 100, the higher the number, the higher the quality (the
lower the compression and the larger the file). I have mine set to 70


--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


"Joe Cool" <joecool1969@xxxxxxxx> wrote in message
news:2d00ae98-2632-4fae-9f4c-73491c7c91af@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Dec 16, 11:01 am, "David"
<david.colliver.N...@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi,

If you have been reading the group recently, you will have seen that I
have
been having WIA problems, but a different set of problems. I am using the
Transfer rather than ShowAcquireImage so that I don't pop-up the scanner
interface and have more buttons to press.

However, I noticed that same issue. I also noticed that I had to
specifically set the resolution of the scanner to get a reasonable file
size
as it tended to scan at max resolution. However, as you are using the
interface, it should take your interface details.

I also noticed that if I set the scanner colour settings AFTER I set the
resolution, my resolution settings would also be reset.

I don't have an answer to the problem you are raising, but have accepted
that if I want to ensure it is a jpg and control the compression settings,
then I have to use the filters.

I have not tested the sample code I found for conversion, but it
appears to just convert BMP (or whatever) to JPG. How do you adjust
the compression settings with the filters?


--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com- Local franchises available

"Joe Cool" <joecool1...@xxxxxxxx> wrote in message

news:f2dac47a-d321-48a2-ad0b-dbb99f7612d7@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



I am trying to add some simple scanning code to an app to use my WIA
compliant scanner. I have downloaded and installed the WIAAUT.DLL I
found some sample C#.NET code that uses WIA and have a simple test app
that will invoke my scanner's WIA driver UI that lets me run a preview
scan, mask the area I want to scan, adjust the DPI, etc, and then
scan. All well and good.

Here's the rub. It doesn't matter what value I pass to the FormatID
property, the returned ImageFile object is ALWAYS in Window BMP
format!! I want to save as JPG. But the saved file is always the same
exact length and an image editor says that they are all BMP files.

I have found some code that uses the WIA ImageProcess class that can
convert a BMP file to a JPG file, but why should I have to do that?

Sample Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WIA;

namespace WIAScanner
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
WIA.CommonDialogClass scanner;
ImageFile imageObject;

scanner = new CommonDialogClass();
imageObject = scanner.ShowAcquireImage
(WiaDeviceType.ScannerDeviceType, WiaImageIntent.ColorIntent,
WiaImageBias.MinimizeSize,
ImageFormat.Jpeg.Guid.ToString("B"), false, true,
true);
MessageBox.Show(string.Format("File Extension = {0}\n
\nFormat = {1}", imageObject.FileExtension, imageObject.FormatID));
imageObject.SaveFile(@"E:\test.jpg");
MessageBox.Show("Done");
}
}
}


.



Relevant Pages

  • Re: Canon FS4000US focus
    ... If anything, the focusing ability ... The first thing I can suggest is to see what VueScan settings you are ... select "always" so that there is no doubt that the scanner will try to ... This is the location in the frame where the focusing routine ...
    (comp.periphs.scanners)
  • Re: Secedit box on startup creating weird networking issues
    ... click on Start, Run, MMC, add the Group Policy MMC for the local computer ... antivirus scanner with the latest updates if you want to double-check [such ... > secedit window would show up briefly on both computer ... > viruses) I never changed any settings on either computer. ...
    (microsoft.public.security)
  • Re: scanning options for slide archival...
    ... Silverfast lets you "manual everything" as well as auto by use of their "expert" settings ... I should have just sent my father a weblink to the bhphoto page for a Nikon dedicated slide scanner and told him my flatbed wouldn't cut it. ... with really fundamental and elementary bugs. ... Suffice it to say I won't be buying any products dependent upon Canon software in the future. ...
    (comp.periphs.scanners)
  • Re: HP Copying Utility
    ... 'photocopying' of documents by just pressing the copy button on the ... scanner the trouble is its printer settings default to Letter and not A4 ... I enable the scanner buttons, they still call up the HP copier, do I just ...
    (comp.periphs.scanners)