Link to home
Start Free TrialLog in
Avatar of bisher
bisher

asked on

scanning pictures

I have a customer who need to scan pictures and insert it into database. Is there is any way to scan directly from Access form and insert the scanned pictures in the database without the need to be scanned and saved externally and then to be inserted in the database.
Avatar of repstein
repstein

bisher:

There are a variety of ocx products that can be incorporated into applications supporting ActiveX (like Access)

A source for a wide variety of ActiveX Controls is

http://www.componentsource.com

The iTwain OCX is located on this site at:

http://www.componentsource.com/cs/Catalog/CSProduct.asp?ProductOptions=2863_6X


This product allows direct control of any Twain compliant image source. It supports All Access versions from 2.0 to 2000. You can download a free 30 day demo to try it out.

Happy scanning.

Richard
bisher:

Sorry, the direct link doesn't go to the page I suggest you look at.

Just go to the main site and search on iTwain.

Richard
ASKER CERTIFIED SOLUTION
Avatar of spruce22
spruce22

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bisher

ASKER

To spruce22 :
   I've tried your solution and I received error 2101.
bisher,
Error 2101 probably means that you used an invalid file name for what the SourceDoc property of the OLEPicture control.  In the ImgScan1_ScanDone event, make sure that the file you're assinging to the source document actually exists on your computer.  You can do this by placing a breakpoint next to the line of code that says

  With Me!OLEPicture
    .OLETypeAllowed = acOLEEmbedded 'Allow embedded OLE types
    .Class = "Paint.Picture" 'Insert the type of picture you want
    .SourceDoc = "C:\My Documents\TempImg.bmp" 'Tell the OLE control which picture to use
    .Action = acOLECreateEmbed 'Store the image in the database
  End With

End Sub


To place a breakpoint in code, go to the code window and click the grey area right next to the word With!OLEPicture.  A red dot should appear, and when you run the code it should stop at this line.  At this point go to the Windows Start Menu and click Find, Files or Folders, and in Named enter the same path you have assigned to the .SourceDoc property, in the case of the example it would be C:\My Documents\TempImg.bmp (note the lack of quotes).  If the file shows up here, then there's another problem going on, otherwise it wasn't actually created by the scanner.  Try this and let me know what happens.
Avatar of bisher

ASKER

I've checked the code and didn't found any error. One more thing I didn't find the file after the picture has been scanned.
bisher,
Did you determine if the scanner actually created the pitcure?  If not, the file is deleted after the scan completes.  What do mean when you say you checked the code and didn't find an error?  If you wish you can send me the database to look at the code, my email is in my EE profile(click on Spruce22 under one of my Comments).

spruce22
Avatar of bisher

ASKER

spruce22 :
  I found the error, and thanks it works fine, but I noticed from the code that the pictures is saves using bmp format is there any way to change it to gif or jpg.
bisher,
I belive the only three file formats available with the Kodak Image Scan control are as follows:
..FileType = AWD_MicrosoftFax
..FileType = BMP_Bitmap
..FileType = TIFF

So, you can create a AWD(which I'm not famaliar with, apparently it's for faxing), a bitmap, or a TIFF file.  There's no built in support for gif or jpg scanning.  However, when the Scan screen is brought up(after the .StartScan method), does the scanner's interface allow you to select what file type you wish to scan as?  If so, you could just select jpg or gif from the scanner's menu, and then proceed.  If this works let me know because I'll have to do some additional research into what kind of OLE class you save the picture as, from the example(for bitmaps) the .Class = "Paint.Picture", but it will probably be different for jpgs or gifs.

If the scanner's interface doesn't allow you to select what type of file to scan as, and it's critical to save as a jpg or gif, then you'll probably have to look into finding another ActiveX control to do your scanning.  For example, the iTwain OCX mentioned by repstein earlier might be able to save as jpgs or gifs.  The problem there is you ususally have to pay for these types of controls, where as the Kodak controls are free.  If you don't mind me asking, why gifs or jpgs instead of bmps?  Let me know what you find.

spruce22
bisher:

iTwain will scan in any image format supported by your scanner. I am not sure if you can select the file format directly within the control, or if you have to display the scanner user interface and pick it there. You may be able to set the default scan file type within the scanner software to be what you want. In any case, they do offer a free 30 day demo so you should be able to quickly figure out if this ocx will meet your needs.

If you are stuck with bmp and must have jpeg (I assume for to save disk space and speed image loading), there are conversion controls available that will allow you to do this in code. One that I am aware of is the Victor Image Processing Library. This is a dll. You could scan the image to a bmp file, load it as a bmp, and then save it back as a jpeg.

Both iTwain and Victor can be found at
www.componentsource.com

Alas, neither are free (and Victor is a bit pricey), but both allow free distribution of the run-time version. You could probably search around and find cheaper versions of a file type converter, or perhaps spruce22 can point one out to you.

You might also look at the kodak site www.eastmansoftware.com for their other image processing products. I would also double check and make sure that you will be able to freely distribute the Kodak ActiveX, or if users not having the ocx on their machine will have to download it from Kodak.

Good luck

Richard

Avatar of bisher

ASKER

spruce22 :
  I have a customer who want to scan a designs in his showroom and send them to the workshop, with the ability to keep track of customer and price collecting. The deisgns are on A4 paper size which in BMP format it will be very big to be send thru dial up line, specially with the number of design he want to send on daily baes
bisher,
I downloaded the iTwain control to see if it could do what you needed, and it does allow you to set the source file type as jpeg.  From the help file, under the SetTransferFile method the following file types are avaialble.
0 - TWFF_TIFF 'Tagged
1 -TWFF_PICT
2 - TWFF_BMP 'Windows Bitmap Format
3 - TWFF_XBM'X-Windows Bitmap Format
4 - TWFF_JFIF'JPEG File Interchange Format

So you may want to go with this control, as it will allow to scan in the format you wish.  This would be much better than converting the file after it's scanned as bitmap.  And you can still use Kodak Image Edit control to display the file after the scan is done(and these controls are free to distribute, although you do have to run the Kodak installation program if they're not already on the users machine, but they're installed with Win98 and you would only download the installation once and then run it on each machine as needed.)

spruce22
bisher:

If you decide to go with the iTwain control as the "answer", I suggest you award the points to spruce22, since he spent much more time on this question that I did.

Richard
repstein,
Thanks!  I'm sort of new here, but isn't there a way points for a question could be split?  If not and I do "get the answer", I sincerely appreciate your input and the manner in which you conducted it.

spruce22
to bisher and spruce22

My understanding is for a questioner to split points, a request has to be made to Community Support (as a 0 point question) requesting to decrease the number of points for the question. Then the questioner assigns the new value to
primary answerer and generates a new question to the other answerers.

For example Commander Kirk and Mr Spock collaborate on an question posed by Lt Ohura. Ohura wants to award Kirk 100 pts and Spock 50 from the 150 points offered for the answer. She sends a question to Community Support asking to decrease the point value for the question to 100 (with the reason), assigns the answer to Kirk, and generates a new 50 point question for Spock. Eg, what is the name of your ship? When Spock answers, Ohura awards him a correct answer and he gets the 50 points. This roundabout scheme is necessary because questioners can only increase the value of a question, not decrease it.

What often happens is that an expert who is awarded points generates a question for a collaborator, and gives that person the points. This results in a deduction from the experts available points, but since many experts have points to "burn", they don't care. For new experts who may not have that many available points accumulated, this approach may not be suitable.

There really has to be a better way to do this!

Richard

PS I appreciate your appreciation. In my mind the primary reason to participate in this forum is to help others, and by doing so, to increase one's own knowledge of Access.
hi bisher.

How's the scanning going?
Avatar of bisher

ASKER

It's going fine, I doanloaded the twain and it's working fine. Thanks
Avatar of bisher

ASKER

It's going fine, I doanloaded the twain and it's working fine. Thanks
Great!  Did you decide on which answer to accept(if any)?  If so, could you close the question by choosing Accept Comment as Answer.  If you choose mine, I'd give repstein a question for 25 points, so you don't have to go through the Command Kirk & Mr. Spock scenario described by repstein above.

repstein,

If you're still listening there's a question posted for you.  Thanks again.

spruce22
Got it. Thanks.

Richard