Link to home
Start Free TrialLog in
Avatar of Kosie2K
Kosie2K

asked on

Saving BMP to Jpeg format in VB 6

Is there any source-code for saving .bmp to .jpeg files.
I would like it if somebody can point me to a source that doesn't actually require DLL's or Classes. If not, could someone explain to me how to do this. The sources i've found on the net only contain links or require DLL's, witch is a hassle.

VB saves files as .JPG but the size is too big (+1.1M.)
This is for a screen capture at 800*600 res. & 16 Bit Colours. I know VB uses your current settings to save the pic, but i can't run the program at 256 Colours.

If no one knows of any source code or sites that can help me in this, I would appreciate it if there is a link to a compression utility/coding/app that i can use/find.

Much credit will be given and more if available.

Thanx :)!
Avatar of PaulHews
PaulHews
Flag of Canada image

I've never seen this done in VB, the only open source code I've seen for Jpeg is the Independent JPEG Group's work which is in C.

http://www.ijg.org/
Avatar of dwalsarie
dwalsarie

If you would not want to use DLL's or Classes,
the JPEG compression would get really slow, and
you would have a lot of code which is really difficult.

I used this approach: the free Intel JPEG Library
A complete demo and tutorial can be found at
http://www.vbaccelerator.com/codelib/gfx/vbjpeg.htm
I'd check planet source code.  They are great resource for things like that.  
I guess I could give you the URL couldn't I.  DUH.  http://www.planet-source-code.com
www.smalleranimals.com offers an excellent image processing DLL (ImgSource) that is relatively easy to use with VB.  It costs around $25.

http://www.vbaccelerator.com/codelib/gfx/vbjpeg.htm has code and links to a freeware DLL that can be used to save to JPG.  (This is probably the code you are talking about, but it is probably your best solution for free, unless you wish to translate IJG's work to VB--not an easy task!)
it seems someone sent me pure VB code to save as JPG a while back, but i wont know until i get home.  if i remember correctly, it was some long, ugly code, and most surely, performed much slower than its C equivalent.
ASKER CERTIFIED SOLUTION
Avatar of glass_cookie
glass_cookie

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
Avatar of Kosie2K

ASKER

To: glass cookie.

your dll works sort of but i need a more descriptive explanation of all it's functions.. I have read the Txt Document but am still a little confused... Also the first link you provided gave me an DLL but REGSVR32 can't register it.

is there any e-mail address where i can contact you?

If need be send it to Kosie2k@yahoo.com

Thanx! :)
Kosie2K, the reason regsvr32 doesn't work is that the dll is a standard dll not an activex dll. Only activex dlls need to be registered, a standard dll is accessed in a different way: Private Declare Function BmpToJpeg Lib "JPeg32.dll" (ByVal BmpFilename As String, ByVal JpegFilename As String, ByVal Quality As Integer) As Integer from the jpeg32 activex control.
Avatar of Kosie2K

ASKER

Thanx a lot! :)

It does work but i have to play with it still to get it under control....

One other question... Is this Open Source or not?
Sorry... it isn't my dll - It's written by someone : |