Home | About us | Overview | Softwares - Downloads | Evaluate | Order | Support | old forums | Contact | F.A.Q. | Documentations | Search | Sitemap

High Resolution Scanning 2400dpi

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

High Resolution Scanning 2400dpi

Postby MIKES on Mon Oct 06, 2008 11:09 pm

Hi,

We recently picked up an Epson GT-20000 scanner.
Which works real nice and for the most part works great with GdPicture.
It is the first scanner we have had that can, realistically, do High Res Scans.
Now this is not something that we be using the scanner for every day.
I suspect it will rarely be used above 600dpi.
It works fine with my program up to 1200 dpi.
At 2400 dpi, After the page is scanned and displayed in the viewer,
I get an error about an invalid page size and then a "Generic" GDI+ error.

I have not tracked it down exactly but I believe the error is happening in the thumbnail creation.
Is there any special handling I should be doing for hi-res scans?

Here is my thumbnail generation.
Code: Select all
Dim nThumbnailID As Integer
        Dim nCpt As Integer
        Dim thumbWidth As Integer = 78
        Dim thumbHeight As Integer = 100
        Dim imageWidth As Integer = 82
        Dim imageHeight As Integer = 100
        Dim page As PVI.page
        Dim Wait As New WaitCursor
        ImageList1.ImageSize = New Size(thumbWidth, thumbHeight)
        ImageList1.Images.Clear()
        lvThumbnail.Items.Clear()

        If nImageId <> 0 Then
            Viewer1.ZoomMode = GdPicturePro5.ViewerZoomMode.ZoomFitToControl
            For nCpt = 1 To pviGdPicture.Imaging1.TiffGetPageCount(nImageId)
                pviGdPicture.Imaging1.TiffSelectPage(nImageId, nCpt)
                nThumbnailID = pviGdPicture.Imaging1.CreateThumbnailHQEx(nImageId, imageWidth, imageHeight, GdPicturePro5.Colors.LightGray)
                pviGdPicture.Imaging1.SetNativeImage(nThumbnailID)
                Call ImageList1.Images.Add("", Bitmap.FromHbitmap(CType(pviGdPicture.Imaging1.GetHBitmap, IntPtr)))
                Call lvThumbnail.Items.Add(nCpt.ToString, nCpt - 1) ' has the page number under thumbnail.
                pviGdPicture.Imaging1.CloseImage(nThumbnailID)
                page = New page
                page.Brightness = 20
                page.Contrast = 20
                page.Luminance = 20
                page.Saturation = 20
                pImage.pages.Insert(nCpt - 1, page)
            Next nCpt
            pviGdPicture.Imaging1.SetNativeImage(nImageId)
            pviGdPicture.Imaging1.TiffSelectPage(nImageId, 1)
            Viewer1.SetNativeImage(nImageId)
        End If
        Me.lvThumbnail.LargeImageList = ImageList1
        ' After populating always select first image.
        Me.lvThumbnail.Items(0).Selected = True
        CType(Wait, IDisposable).Dispose()


Thanks
Mike S.
GdPicturePro5 v5.8.0
Vb.Net /Visual Studio 2005
MIKES
 
Posts: 26
Joined: Thu Jul 31, 2008 9:03 pm
Location: Michigan

Re: High Resolution Scanning 2400dpi

Postby Loïc on Tue Oct 07, 2008 3:57 pm

Hi,

Your page is probably not scanned (not enough memory) ? In case of not enought memory, you can try to use the file transfer mode using the TwainAcquireToFile() method.

See:

http://www.guides.gdpicture.com/v5/gdpi ... oFile.html

I suggest you to check all the returned value of the GdPicture methods to catch where the error come.

Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 1350
Joined: Tue Oct 17, 2006 11:48 pm
Location: France

Re: High Resolution Scanning 2400dpi

Postby MIKES on Tue Oct 07, 2008 4:57 pm

Hi Loic,

I have revised my code to check status.
Machine is a 4GB Vista 32 bit Business, dual core.
The page is scanned okay and is displayed in the viewer okay.
When the TiffSelectPage is done in the code, the GdPictureStatus returned is okay.
The problem is in the CreateThumbNailHQEx line.
It is not returning a Handle (i.e returns 0)
I now do Imaging1.GetStat in this case and it is returning a GdPicturePro.Status of 3, out of memory.
Though I do show 1.5GB of free available memory at this point, I realize that might not be the memory this function is using.

Was considering trying the "non HQ" thumbnail functions just for kicks.
Do you have any additional ideas?
Thanks
Mike
Code: Select all
For nCpt = 1 To pviGdPicture.Imaging1.TiffGetPageCount(nImageId)
                nStatus = pviGdPicture.Imaging1.TiffSelectPage(nImageId, nCpt)
                ' Create thumbnail does not return a status. If Handle zero, Check last status ?
                nThumbnailID = pviGdPicture.Imaging1.CreateThumbnailHQEx(nImageId, imageWidth, imageHeight, GdPicturePro5.Colors.LightGray)
                If nThumbnailID > 0 Then
                    ' Set Native Image does not return a status.
                    pviGdPicture.Imaging1.SetNativeImage(nThumbnailID)
                    Call ImageList1.Images.Add("", Bitmap.FromHbitmap(CType(pviGdPicture.Imaging1.GetHBitmap, IntPtr)))
                    Call lvThumbnail.Items.Add(nCpt.ToString, nCpt - 1) ' has the page number under thumbnail.
                    pviGdPicture.Imaging1.CloseImage(nThumbnailID)
                    page = New page
                    page.Brightness = 20
                    page.Contrast = 20
                    page.Luminance = 20
                    page.Saturation = 20
                    pImage.pages.Insert(nCpt - 1, page)
                Else
                    ' Problem creating thumbnail, no handle returned
                    nStatus = pviGdPicture.Imaging1.GetStat
                End If
            Next nCpt
Mike S.
GdPicturePro5 v5.8.0
Vb.Net /Visual Studio 2005
MIKES
 
Posts: 26
Joined: Thu Jul 31, 2008 9:03 pm
Location: Michigan

Re: High Resolution Scanning 2400dpi

Postby Loïc on Wed Oct 08, 2008 12:18 pm

Hi MIKES,

I think the solution is to use the CreateThumbnail() method.

Also, you can try this tip:

Code: Select all
ntmpimage = pviGdPicture.Imaging1.GetResizedImage(pviGdPicture.Imaging1.GetNativeImage, pviGdPicture.Imaging1.GetWidth / 3, pviGdPicture.Imaging1.GetHeight / 3, InterpolationModeNearestNeighbor)
nThumbnailID = pviGdPicture.Imaging1.CreateThumbnailHQEx(nImageId, imageWidth, imageHeight, GdPicturePro5.Colors.LightGray)

pviGdPicture.Imaging1.CloseImage (ntmpimage)


Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 1350
Joined: Tue Oct 17, 2006 11:48 pm
Location: France

Re: High Resolution Scanning 2400dpi

Postby MIKES on Wed Oct 08, 2008 7:50 pm

Thanks Loic,

Either of the two solutions do work.
Caveats:
1) the non-HQ thumbnail is pretty bad compared to the HQ one
Did it with a Black/White image and there was a lot of black in places that should have been white.
2) resizing the image to a temp image, and using that to create a HQ thumbnail, took twice as long,
But it looks okay.

For now I'm going to limit resolution in my program to 1200dpi.

Perhaps, if you think this is a problem in the CreateThumbnailHQEx method,
you can add it to your list of: " stuff to look into when you have nothing better
to be doing..." :-)

As I mentioned I do not think this is a big issue for us.

Mike
Mike S.
GdPicturePro5 v5.8.0
Vb.Net /Visual Studio 2005
MIKES
 
Posts: 26
Joined: Thu Jul 31, 2008 9:03 pm
Location: Michigan


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 0 guests