[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1002
  • Last Modified:

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
0
hollering
Asked:
hollering
  • 9
  • 7
1 Solution
 
holleringAuthor Commented:
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
0
 
holleringAuthor Commented:
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.
0
 
Gustav BrockCIOCommented:
From the help file.
The syntax is:

object.SaveAs Image[,FileType,PageType,CompressionType,CompressionInfo,SaveAtZoom]

Image      String      The fully-qualified name of the image document being saved
FileType      Integer      The FileType the image is being saved as
PageType      Integer      The PageType the image is being saved as
CompressionType      Integer      The CompressionType at which the image is being saved
CompressionInfo      Integer      The CompressionInfo setting of the image being saved
SaveAtZoom      Boolean      Whether the image is being saved using the current or original scale percentage
  value: True  The image is being saved using the current scale percentage
  value: False  The image is being saved using the original scale percentage value

The following list shows the valid FileType settings:

Constant      Setting      Description
wiFileTypeTIFF      1      TIFF
wiFileTypeAWD      2      AWD
wiFileTypeBMP      3      BMP
wiFileTypePCX      4      PCX
wiFileTypeDCX      5      DCX
wiFileTypeJPG      6      JPG
wiFileTypeXIF      7      XIF
wiFileTypeGIF      8      GIF
wiFileTypeWIFF      9      WIFF

Displayed file types of PCX, DCX, JPG, XIF, GIF, or WIFF must be saved using a FileType setting of 1 (TIFF), 2 (AWD), or 3 (BMP).
If a multipage image file (AWD, DCX, TIFF, WIFF, or XIF) is saved as a BMP file, only the page currently being displayed is saved to the new file.
A file with a .JFX extension is also a TIFF file type.
Note:  AWD is not available with Imaging for Windows NT 4.0.
GIF and WIFF are available with Imaging for Windows Professional Edition V1.0, V1.1, and V2.0; and Imaging for Windows 98.

/gustav
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
holleringAuthor Commented:
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.
0
 
Gustav BrockCIOCommented:
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
0
 
holleringAuthor Commented:
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.
0
 
holleringAuthor Commented:
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.  =)
0
 
Gustav BrockCIOCommented:
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
0
 
holleringAuthor Commented:
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.
0
 
Gustav BrockCIOCommented:
I can mail or upload the help file to you if you wish.

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

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

/gustav
0
 
holleringAuthor Commented:
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.
0
 
Gustav BrockCIOCommented:
You are welcome.

/gustav
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now