[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Save a JPEG returned from EZTWAIN

Posted on 2004-03-22
2
Medium Priority
?
977 Views
Last Modified: 2012-06-21
Trying to save a scanned image as a JPEG file. I acquire the image using EZ TWAIN dll and get back a handle to a DIB. How do I take this handle to the DIB and save it to a JPEG file using the sample code:

http://www.vbaccelerator.com/codelib/gfx/vbjpeg.htm

I been trying to use the SAVEJPG method of the cDIBSECTION class but can't seem to figure out how to convert the handle to a DIB to a cDIBSECTION object so that I can pass that to the SAVEJPG method.

Also looked at FreeImage:
http://freeimage.sourceforge.net/download.html
All example in C++, couldn't figure them out. Need VB code examples

0
Comment
Question by:cshorey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
Kavar earned 2000 total points
ID: 10648825

best I can tell you will need to create a suitable DC, then draw to it, I believe (dont have the structures in front of me)
that the cDIBSection has a DC property, so you should just be able to copy the contents of the db you have a handle to
and then save it.
Declare Function TWAIN_CreateDibPalette Lib "EZTW32.DLL" Alias "TWAIN_CreateDibPalette" _
      ( ByVal hdib as Long ) as Long
'
'  Create and return a logical palette to be used for drawing the DIB.
'  For 1, 4, and 8-bit DIBs the palette contains the DIB color table.
'  For 24-bit DIBs, a default halftone palette is returned.
'
Declare Sub TWAIN_DrawDibToDC Lib "EZTW32.DLL" Alias "TWAIN_DrawDibToDC" _
      ( ByVal hDC as Long, ByVal dx as Long, ByVal dy as Long, _
        ByVal w as Long, ByVal h as Long, ByVal hdib as Long, _
        ByVal sx as Long, ByVal sy as Long )
'
'  Draws a DIB on a device context.
'  You should call CreateDibPalette, select that palette
'  into the DC, and do a RealizePalette(hDC) first.



0
 

Expert Comment

by:spike0xFF
ID: 10818703
The 'Pro' version of EZTwain (http://www.dosadi.com/eztwain3.htm) is commercial, but can load & save JPEG files (and TIFF, PNG, etc.) - It uses the IJG's LibJpeg which is freely available.

[Disclaimer: I'm the author of EZTwain and EZTwain Pro.]
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question