Advertisement

Bitmap compression

Started by November 28, 1999 10:13 PM
11 comments, last by GameDev.net 25 years, 3 months ago
Actually, a 256x256 24-bit BMP file is 192KB, not 2MB

You might think of using PCX files instead, they have built-in compression that usually gives you 25-40% compression. Not as good as WinZip, but hey, it's simple as hell.

The PNG format compresses REALLY well on the images I tested on.

I'm gonna stop talking now, because I don't know all that much about compression and don't want to say something to upset anyone

Does anybody know where I can get the PNG library?

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

Advertisement
Hmmm, not 2meg? Musta done my calculation wrong...

Yah.. it is 190k.. oops...

Hehehehe, I said that 2meg was too big ;-)

The PNG spec is at www.w3c.com (or maybe org)

-the logistical one-http://members.bellatlantic.net/~olsongt
sorry if this sounds stupid, but you figure it out by (256*256)*(24/8)=192*(1024)
is that right, I jus guessed, sorry if its a stupid question, its late and Im not think very clear
later
PCX files only use their RLE compression (192 cutoff) in 256 colour mode. If you want to compress and dont mind slight quality loss, use truevision targa (TGA) or JPEG.
Advertisement
This is how you'd figure it:

256*256 = 65536 pixels

65536*3=196608 bytes

You take it times 3 since there are 3 bytes per pixel in 24bpp.

That's incorrect. ALL PCX bit modes, 8 bit, 24 bit, etc. use RLE compression.
It doesn't stop at 256 colors. (0-255) is the range of the RGB component,
not the number of colors. And who wants to use JPEG which requires you to
use a whole library of complicated code to decode a single image. It only
takes a couple simple functions to decode a image with PCX.

Speck

Listen, if you don't need compression IN the bitmap (if you are using a global compressor like WinZip to package your resources together) then go with Targa. TGA is basically the easiest format to load (other than RAW files that you know the format of).

- Splat

If you're doing 3D with Direct3D, you may want to look into DXTC. It stores the image at 4 bits per texel (at least for DXT1) and hardware support is growing, it's in Nvidia's GeForce 256, S3's Savage4 & Savage2000, 3dfx's upcoming chipset.

This topic is closed to new replies.

Advertisement