Link to home
Start Free TrialLog in
Avatar of Mohammad Alsolaiman
Mohammad AlsolaimanFlag for Saudi Arabia

asked on

Acquire an image file from scanner twain wizard with an extension jpg

Again I have this code to acquire a scanner twain wizard (see the code below,
I have hp scanjet 5590 , the wizard appear to me is this shown in the attached word file:
And as you see there is no place where you can choose the type of image.
It saves the image with file type *.pmb , but I need the images with type *.jpg
Any body can help please>


Private Declare Function TWAIN_AcquireToFilename Lib "TWAIN32d.DLL" (ByVal hwndApp As Long, ByVal bmpFileName As String) As Integer
Private Declare Function TWAIN_IsAvailable Lib "TWAIN32d.DLL" () As Long
Private Declare Function TWAIN_SelectImageSource Lib "TWAIN32d.DLL" (ByVal hwndApp As Long) As Long
 
 
Private Sub btnMasterScan_Click()
On Error GoTo Err_btnMasterScan_Click
If IsNull(InDate) Then
   MsgBox " Please Enter Basic data of the Document, before you can take an image "
   Exit Sub
End If
Dim Ret As Long, PictureFile As String
 
PictureFile = Forms!swetchbord!pblCurrentPath & BookID & ".jpg"
 
Ret = TWAIN_AcquireToFilename(Me.hwnd, PictureFile)
 
If Ret = 0 Then
   Me.ImagePath = BookID & ".jpg"
   Me.MasterPic.Picture = Forms!swetchbord!pblCurrentPath & Me.ImagePath
   Me.btnInlarge.Enabled = True
   strScanMaster = "Yes"
End If
 
Exit_btnMasterScan_Click:
    Exit Sub
 
Err_btnMasterScan_Click:
    MsgBox err.Number & "  " & err.Description
    Resume Exit_btnMasterScan_Click
End Sub

Open in new window

acquire-image-file-with-extetion.doc
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

M_SOLAIMAN,

Just a quick guess here...

If you change the extension of the file from .pmb to .jpg, if you double click the file, does it still open?
If it does, then perhaps you could simply add code at the end to rename the file.

Something like this:
    Name "C:\YourFile.pmb" As "C:\YourFile.jpg"

JeffCoachman
Avatar of Mohammad Alsolaiman

ASKER

Yes , it works but still the file is pmb
And this make it still big file
One image is around 8 MB
But if it is real jpg file it will not exceed 300 KB
Any other solution please
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America 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
yes please
i need to know how to convert it in vba
M_SOLAIMAN,

Everything you need should be in the documentation of the program.
Did you download the demo and the Addins?
Explore the site, everything is there.
;-)

JreffCoachman

i have an example for conversion:
i_view32.exe c:\test.bmp /convert=c:\test.jpg
ok
but how to trigger it from ms access vba please!
I am not sure, because I don't know all of your code, but you should be able to put that code on the click event of a button.
yse;
i try this
it works good

Shell "C:\Program Files\IrfanView\i_view32.exe C:\InOutDocuments\1.jpg /convert=c:\test.jpg"

please if there any more advices
i well be happy
thanks
I think you can handle it from here.
;-)

JeffCoachman
thanks alot