Link to home
Start Free TrialLog in
Avatar of hollering
hollering

asked on

Need to Save Scanned Image in gif format.

I have a database that uses the Kodak ActiveX controls to scan drawings and save them to a network drive.  It's been working so-so.

If the resolution is set too high...say 200 dpi (not as high as we really need it)...then the scanned image will not be displayed on the ImgEdit control.

The example database I found includes the following code to save the image.  I've been using this without the second argument, and it works, but it produces huge file sizes.  I presume this is because it is not compressing it to the file format but writing it out uncompressed.  Note that I am not using this routine.  My own does not use the ScanAdmin.ShowFileDialog line to get a file type.  Instead every image is to be saved to the same directory with the same filetype.

I've been giving the files a .tif extension manually.  What I would really like to do is save the file in gif format, compression and all...so that the drawings are more readable.

Dim strFilter As String
Dim strInputFileName As String
Me.ScanAdmin.ShowFileDialog 1
strInputFileName = Me.ScanAdmin.Image
If Len(strInputFileName) > 0 Then
    Select Case Right(strInputFileName, 3)
        Case "tif"
            Me.scanEdit.SaveAs strInputFileName, 1
        Case "jpg"
            Me.scanEdit.SaveAs strInputFileName, 6
    End Select
End If
Avatar of hollering
hollering

ASKER

Decided I should include my own Save routine...the following code is activated by a save button on a form.

Dim strFilter As String
Dim strFileName As String
Me.scanAdmin.CancelError = False

'SPI is required to create the filename
If IsNull(Me.SPI) Then
    MsgBox "You must enter an SPI number before saving!"
Else
    strFileName = "G:\Apps\DesignWO\WorkOrderImages\" & Me.SPI & "-" & Me.WorkOrderRequestID & ".gif"
    Me.ImageName.Value = strFileName
    Me.scanEdit.SaveAs strFileName
    MsgBox "The scanned image was successfully saved to the following file" & vbCrLf & vbCrLf & strFileName
End If
In that last comment, where it says .gif at the end of that file...I forgot that I was attempting to change it before I started this post.  The production version of the database has been using .tif as I stated in the original question.
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

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
Okay, so I guess I didn't think about the multipage factor when I was thinking of going to GIF.  What about the ImgEdit control?  It won't display scans that are high resolution (large file sizes in general actually).  My users are complaining because they are scanning part drawings for our engineers and the text is coming out fuzzy because I've had to dull down the scan to less colors, lower res, and smaller scale (50%).

Thanks for the help file text...sorry I hadn't found it on my own...but that answers half my question.
Look for the help file now. You may not have it ...

About file size:
Why care that much? Disk space is cheap nowadays.
Do you need colours? If you can go b/w, tiff files can be compressed heavily.

/gustav
I'm not too terribly worried about disk space.  The problem is that the Kodak ImgEdit control doesn't work properly with images that are bigger than somewhere around 1.5 MB...and with the scanner's default settings I get scanned image drawings (8.5 x 11) that are around 10-11 MB.  With 3-4 drawings each day, that would grow out of hand very quickly...even if the ActiveX control could handle the large files properly.
Forgot to mention...the users have expressed to me that they really want to see the drawings in color.  These drawings are requests for engineering changes.  The users are die maintenance personnel who mark up printed drawings with different color ink, then submit their proposed changes to the engineers via the database.  It would be an exceptionally cool system if I could perfect this whole imaging thing.  =)
Oh, that doesn't sound nice.

You may need to spend some money on a control. There are many around targeted to different needs.
Have a look at Simon Chester's csXImage ocx which carries decent support even for the free trial:

  http://www.chestysoft.com/

/gustav
Okay, so I can't find this help file anywhere (I don't feel so bad now).

Can the filetype settings be used to define compression type and compression info as well? one or the other? It says that they are integers...so I'm guessing if I put a 1 in there then that would most likely compress it with standard TIFF compression settings??  Sorry, I'm a little lost when it comes to image formats... :(

I'd hate to buy a control when I seem to be so close to a good solution.  The current solution works well enough to get by, but it just needs some optomizing.
I can mail or upload the help file to you if you wish.

/gustav
Can you please?  That would be great.  Or even if you could tell me where to get it...
Yes I can but where to?
I have no link for it - got it from someone for the same reason.

/gustav
Can you send it to hollering@hotmail.com?  It's one of those addresses I keep for just an occasion =)
That's what I thought. It's on its way.

/gustav
I'm going to rely on the help file from here out.  I can't check my hotmail from work so I'll assume it was delivered.  Thanks for all your help.
You are welcome.

/gustav