Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

Inverted scans using twain.

Last post 26 Jul 2008, 2:14 PM by Glenn. 1 replies.
Sort Posts: Previous Next
  •  24 Jul 2008, 2:30 PM 15043

    Inverted scans using twain.

    Hello, I have been using twain for a while know and I recently noticed a problem that has cropped back up again. On the ImageAcquired event I have a routine that checks the image to make sure it is not an inverted image.

     

        Sub CheckImage(ByVal TheImage As AtalaImage)
            If TheImage.PixelFormat = PixelFormat.Pixel1bppIndexed Then
                ' See if the 0 palette entry is less than the 1 palette entry.
                Dim p0 As Color = TheImage.Palette.GetEntry(0)
                Dim p1 As Color = TheImage.Palette.GetEntry(1)
                If p0.ToArgb() < p1.ToArgb() Then
                    ' Swap the palette entries.
                    TheImage.Palette.SetEntry(0, p1)
                    TheImage.Palette.SetEntry(1, p0)
                    ' Invert the image data.
                    Dim inv As Atalasoft.Imaging.ImageProcessing.Channels.InvertCommand = New Atalasoft.Imaging.ImageProcessing.Channels.InvertCommand
                    inv.Apply(TheImage)
                End If
            End If
        End Sub

     

    This was working great for a while and now it seems to have stopped working. If I use this sub or not I get an inverted image.  The Kodak i30 scanner i am using has a scan utility that when used it creates a correct scanned image. (White background, Black Text) Any information on this would be great. I am not sure if anything has changed in a past build that might be affecting this. Thanks.

  •  26 Jul 2008, 2:14 PM 15064 in reply to 15043

    Re: Inverted scans using twain.

    Nothing has changed in DotTwain that would cause this. 

    Are you loading the image from a file or showing it directly in our viewer after acquired?  If it looks inverted in our viewer, then the image data is truely inverted.

    Try updating the code you're using to what is in this KB:  http://www.atalasoft.com/KB/Article.aspx?id=10069

    If that doesn't help, then try setting the Device.PixelFlavor property to TWPF_VANILLA before you acquire.


    Glenn Chittenden Jr.
    Atalasoft Development Team
View as RSS news feed in XML