Unable to set DPI

Jan 6, 2009 at 4:19 AM
Hi, Please Solve my problem.

I am using Microsoft twain_32 dll functions to set x and y resolution for scanner(eg.200dpi,300dpi etc.,).

But i got the output image with the resolution of 96dpi (shown by windows properties dialog and microsoft picture manager).

I am also set the units before set the resolution.

I am using the following code to set resolution.

-----For Units----


Function SetUnits(ByVal value As String) As Boolean





Dim cap_units As Enumerations.Capability = Enumerations.Capability.Icap_Units




Dim capxrcnt As New DataStructures.twCapability(cap_units, Enumerations.Units.Pixels, Enumerations.Containers.twOneValue )




Dim retBool As Boolean = OperationTriplets.Control.Capability.Set(capxrcnt)




End Function




---------For X Resolution----


Public Function SetScannerXResolution(ByVal Value As String) As String




intValue As Integer = CInt(Value)




Dim cap_XResCount As Enumerations.Capability = Enumerations.Capability.Icap_XResolution




Dim XResCountOneval As New DataStructures.twOneValue


XResCountOneval.ItemType = DataStructures.twCapability.CapType(cap_XResCount)

XResCountOneval.Item = intValue



Dim capXResCount1 As New DataStructures.twCapability(cap_XResCount, XResCountOneval)




Dim retBool As Boolean = OperationTriplets.Control.Capability.Set(capXResCount1)




End Function




-----For Y Resolution----


Function SetScannerYResolution(ByVal Value As String) As Boolean




Dim intValue As Integer = CInt(Value)




Dim cap_YResCount As Enumerations.Capability = Enumerations.Capability.Icap_YResolution




Dim YResCountOneval As New DataStructures.twOneValue


YResCountOneval.ItemType = DataStructures.twCapability.CapType(cap_YResCount)

YResCountOneval.Item = intValue



Dim capYResCount1 As New DataStructures.twCapability(cap_YResCount, YResCountOneval)







Dim retBool As Boolean = OperationTriplets.Control.Capability.Set(capYResCount1)



 Return retBool




End Function



I got return type true for all properties,but the changes are not into effect.

I request you to check out my issue and let me know how can i proceed further.

Jan 6, 2009 at 8:04 AM
your resolution code is probably correct, the only way to know if your resolution code is correct is to check the twImageInfo fields in twState 6 or 7.  Your 96dpi properties are probably due to the way you save the image, using GdipBitmapSetResolution during the save operations solves most of these issues.

Start with the twImageInfo.
Aug 10, 2010 at 12:44 PM

This is a real problem!

using Bitmap.SetResolution(res,res); Takes a long time and uses a lot of memory... With large images this is unusable.

There must be a better option for correcting this problem?


Aug 23, 2010 at 3:33 PM

if you find one post it here and I'll include it in the next release.



Nov 8, 2010 at 1:23 PM

if I find one what?!