Scanned images from twain to TIF and Bitdepth ?

Discussions about image processing and document imaging.
Post Reply
User avatar
2basix
Posts: 7
Joined: Wed May 23, 2007 1:23 pm
Location: Netherlands
Contact:

Scanned images from twain to TIF and Bitdepth ?

Post by 2basix » Sun May 27, 2007 11:30 pm

Hi there,

I have got a question..
I have scanned an image from the Twain source with the following vfp code :

Code: Select all

oGdPicture.TwainOpenSource(thisform.tsources.Value)
oGdPicture.TwainSetHideUI(.T.)
oGdPicture.TwainSetCurrentResolution(200)
oGdPicture.TwainSetCurrentPixelType(2)
oGdPicture.TwainSetCurrentBitDepth(8 )
oGdPicture.TwainSetPaperSize(1) && A4 format
lImageId=oGdPicture.CreateImageFromTwain()
IF lImageId != 0
  oGdPicture.SetNativeImage(lImageId)
  oGdPicture.SaveAsTiff ("c:\testtwain3.tif", 2, 0)     && works OK
  oGdPicture.SaveAsTiff ("c:\testtwain3.tif", 2, 8 )     && Does NOT Work
ENDIF
Question

oGdPicture.SaveAsTiff ("c:\testtwain3.tif", 2, 8 )
This function does NOT work, I get a file with size = 1Kb and is empty
So the third parameter (in this case 8 ) does not work ???

Hope you can help ?

Regards,

Leo
Last edited by 2basix on Tue May 29, 2007 1:40 pm, edited 5 times in total.

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

Post by Loïc » Tue May 29, 2007 11:30 am

Hi,


oGdPicture.SaveAsTiff ("c:\testtwain3.tif", 2, 8 )

This call can fails with old gdiplus.dll version.

You can replace it by

Code: Select all

oGdPicture.ConvertTo8BppQ()
oGdPicture.SaveAsTiff ("c:\testtwain3.tif", 2)


2) oGdPicture.SaveAsTiff ("c:\testtwain3.tif", 2, 0)
This Scans the file, But the result is rotated to the left ?????



:shock: I am a bit surprised. I don't see any reason that your image is rotated to the left. Are you sure on this point ??

Best regards,

Loïc

User avatar
2basix
Posts: 7
Joined: Wed May 23, 2007 1:23 pm
Location: Netherlands
Contact:

tiff & twain

Post by 2basix » Tue May 29, 2007 11:54 am

Hi Loic,

I'll try the newer dll first..

I have had a rotated picture, but that was a mistake, so ignore
the rotation bit in these posts.. :oops:

Thnx,

Leo
Last edited by 2basix on Tue May 29, 2007 1:38 pm, edited 3 times in total.

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

Post by Loïc » Tue May 29, 2007 11:57 am

I've tested the code and I have not this problem with a canon DR 9080C and an emulated TWAIN driver.

Could you send me the rotated image by mail ?

Regards,

Loïc

Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 2 guests