• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Bit map compression

I'm writing a small graphic program. Does anybody know how to compress a bit map when it is saved? Like in Photoshop when you save a jpg or gif it will compress the size of the file to a smaller size.
Any information is welcome
Justin Gibson
1 Solution
Well, usually a Bitmap isn't compressed (a .BMP), but it can be done, using RLE compression (Run Length Encoding). RLE uses this scheme:

Say you have six black pixels:

0 0 0 0 0 0

with RLE it gets compressed to this:

6 0

Anyway, for better explanation search using www.mamma.com or something like that for RLE compression, or JPEG compression or ....


afiak VB cannot save to gif/jpg.
You have to use an external tool to do that.
So PSP or Photoshop or some OCX
Code to save a StdPicture object can be found at:

waderainAuthor Commented:
Excellent code. Exactly what I was looking for!
waderainAuthor Commented:
Vbmaster (or anyone else that can help me out),

I went to the vbaccelerator site (http://www.vbaccelerator.com/codelib/gfx/vbjpeg.htm) and got the bitmap compression code. It worked great but I found if you save and reopen a design more than 9 or 10 times the design slowly starts to turn yellow, Do you know how I can fix it? I sent a  e-mail off to the guy at vbaccelerator but he never got back to me.

Thanks again
Justin Gibson
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

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