It is fine, I didn't notice it. Now the coloring is working fine. But I can't control the color. It is too dark and not a fine level. I changed values of Brightness and Contrast but no change.
Any idea about this ?
Have you tried to simply set the brightness/contrast variables to zero? You may want to visit MSDN and read up on the WIA properties and effects of those settings
Insomnia is just a byproduct of, "It can't be done"
It is quite bizarre to loop through like that. Many of the commonly used properties can be accessed by Name, making this unnecessary.
I've never found any comprehensive list, and it probably varies by device. But you could loop through once to create a reference document listing each property's Name, PropertyId, (Variant) SubType, and default, min, max values, whether read-only or a vector, etc. since these are all properties of a "Property" object.
Crude example from MSDN:
Code:
Dim dev 'As Device
Dim p 'As Property
Dim s 'As String
Set dev = CommonDialog1.ShowSelectDevice
For Each p In dev.Properties
s = p.Name & "(" & p.PropertyID & ")"
MsgBox s
Next
The surprising thing is, I get result all clear when I run application from the code, but if I run the application after compiling to EXE the image comes in black & while only.
What may be the issue ?
Here I attach the sample code of scanning I use in my project.
The code work perfectly and show color image, but after it is complied to EXE the image will be black & white only.
And another mysterious is after scan completeed a word (False) is written in the top left corner of the Form
Can anybody check the code and compile it to EXE and advise me where is the mistake is happened
Line 79 of Form1 is Printing a Boolean expression, so that explains your False. Why would something so basic be a mystery?
Get rid of your On Error GoTo Last, this may well be obscuring some exception. Or not. But in any case this is a very bad practice.
I don't see any reason why the compiled program should act any differently. Did you recompile it after changing the WiaImageIntent property value to 1 (ColorIntent)?
I removed On Error GoTo Last and there is no any error in running the project. I compiled to EXE after changing the WiaImageIntent property value of ColorIntent to 1 but the result is same the output image is still black & white
What may be the wrong in the code ?
I dug into the boneyard here and found two old scanners. One only has TWAIN drivers but the other has WIA drivers, so I connected it.
Scanning for color I get false-color tints that seem to vary. Sometimes all blue, sometimes all yellow, all pink, or all green. So I think that's just this old scanner.
However I get color just fine (except for the weirdness) with your program both in the IDE and compiled.
I also tried a program written from scratch without all of the copy/paste bugs you have there, and it works fine compiled or in the IDE, greyscale or color (again, except for my weird tinting issues but those occur using IrfanView or Windows Photo Gallery to scan too).
To use it you will need to change the resolution in the program. My scanner doesn't do 200 DPI though it has 75, 150, 300, 600, and 1200 - so I had chosen 150 to test with.
Last edited by dilettante; Feb 16th, 2012 at 08:07 PM.
Reason: updated attachment a little
I surprised again when the complied EXE of your code also doesn't give me a good result and the image was still black & white. But I could find out the issue. Really the problem is not in code or not complied exe, but it is from the Scanner itself. In my office we use scanners of 3 companies:
The first two scanners give the good result and color image in both IDE and EXE, but the 3rd one Canon Scanner which I use for my job gives color image from IDE but black & white image from complied EXE. So the exact problem is from Canon Scanner as I think.
Well both in your code and in the example as I posted it, the default scanner is being assumed and used.
If you take my example and set the ShowDialogs compile-time constant to True then recompile and test it both ways you can specify exactly which scanner to use, and probably even check its properties.
Maybe you are running the compiled program in a slightly different user context than the IDE, and some properties may be configured dfferently in these two contexts. This is most likely in the post-XP world.
I retested with yet another scanner that doesn't have any flaws (unlike my boneyard samples) and I see zero difference between running within the IDE and running the compiled program with this one too.
Last edited by dilettante; Feb 15th, 2012 at 09:07 PM.