Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving image in JPG format 4

Status
Not open for further replies.

koala15

Programmer
May 9, 2001
322
AU
Hi all,

I have an image displayed in an Image control and I will like to export it to a file of minimum size - my problem is that SavePicture() will only output a .BMP file type even though the source may be .JPG. (The .BMP is anything up to 10 times larger than the original .JPG file).

Does anyone know of a "function" that will enable the image control's .Picture property to be exported to (say) a .JPG file?

Thank you.

"Life is full of learning, and then there is wisdom"
 
Have a look at this thread: thread222-489226
the link jownwm has should be what your looking for.

-Niphyr

------------------------------
------------------------------
 
Niphyr,

Thank you, however (don't we all hate that word) that .dll assumes that the .bmp file is located at "C:\tmp.bmp", very unfortunate as some admins lock off the c:\ for writing for obvious reasons.

I am going to recompile the source code adding an argument for the source file path.

Cheers and thanks again

"Life is full of learning, and then there is wisdom"
 
The dll assumes nothing. The example VB project does, but naturally you can write your own code.

Probably worth pointing out that you don't actually need to use a 3rd party code library (although for some versions of the Windows OS it might be easiest).

Here are a couple of other options:

1) If you have XP, consider using the Windows Image Acquisition Automation Library version 2.0, available here: Note that the above provides a new component for the VB toolbox. Under XP you should already have WIA type libraries registered, which can be found under references as Microsoft Image Acquisition 1.01 Type Library, but the
version2.0 libraries are better. Using WIA you can convert between BMP, JPG, GIF, TIF and PNG formats

2) Sadly, the Windows Image Acquisition libraries are not available on any OS prior to XP. However, they are actually built on top of GDI+, which is available to all MS operating systems except W95 (and the redistributable is available here:
Most of GDI+ is difficult to use directly from VB, so you really need to get hold of a GDI+ type library. The one I use is here:
Note that this is just a type library, not a code library
 
strongm,

Thank you - the direct pointers you provided (and the follow on pointers they provided) are all VERY excellent.

That will keep me interested for a while.

Cheers.

"Life is full of learning, and then there is wisdom"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top