Grey background on scanned documents

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
nschafer
Posts: 28
Joined: Tue Oct 30, 2007 10:05 pm
Location: Florida, USA

Grey background on scanned documents

Post by nschafer » Fri Mar 19, 2010 8:29 pm

Hello Loic,

I'm having a problem with documents I scan having a grey background instead of white. When I scan the same document with the same scanner using other software the background is white. In both cases I am scanning greyscale. My version is 6.4001 (I'll update to the latest).

The code I'm using is below, thanks for any help you can procide.

Neal.

Code: Select all

            //Here we will scan in a 8bit Grayscale 200DPIjpeg file
            if (Imaging1.TwainOpenDefaultSource(this.Handle))
            {

                InitScanConfig();
                if (chkDuplex.Checked)
                {
                    Imaging1.TwainEnableDuplex(true);
                }
                else
                {
                    Imaging1.TwainEnableDuplex(false);
                }
                if ((int)cmbDocType.SelectedValue == 25)  // Higer Res for R2 Images
                {
                    Imaging1.TwainSetResolution(300);
                }
                else
                {
                    Imaging1.TwainSetResolution(200);
                }
                Imaging1.TwainSetPixelType(TwainPixelType.TWPT_GRAY);
                Imaging1.TwainSetBitDepth(8);
                Imaging1.TwainSetPaperSize(TwainPaperSize.USLETTER);
                saved = false;
                if (Imaging1.TwainHasFeeder())
                {
                    Imaging1.TwainSetAutoFeed(true);
                    Imaging1.TwainSetAutoScan(true);
                    int twainstate = (int)Imaging1.TwainGetState();
                    while (twainstate == 6 || (twainstate > 3 && Imaging1.TwainIsFeederLoaded()))
                    {
                        ScanPage();
                        twainstate = (int)Imaging1.TwainGetState();
                    }
                }
                else
                {
                    ScanPage();
                }

                if (Imaging1.TwainGetState() == TwainStatus.TWAIN_SOURCE_OPEN) 
                {
                   // Imaging1.TwainCloseSource();
                }
                txtPageCount.Text = currPage.ToString() + " of " + pageCount.ToString();
                GdViewer1.SetZoomFitViewer();
                loadPage();
                this.Focus();


        private void InitScanConfig()
        {
            Imaging1.TwainSetHideUI((chkHideUI.Checked));
            Imaging1.TwainEnableDuplex(chkDuplex.Checked);
            Imaging1.TwainSetAutoSize(true);
        }


User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Grey background on scanned documents

Post by Loïc » Mon Mar 22, 2010 9:43 am

Hi,

Maybe the other software scans in 1bpp and not in 8 bpp ?
In all case, adjusting the brightness or contrast of your scanner should improve scanning result.

With best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest