PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Use 24 bit bmp to generate 565, 555 and 12 bit bmp?

I would like to use a single data source of bitmaps to generate different format of bitmap for different platforms for my game.

However, I don't know if I should use 24 bit bmp as data source to generate 555, 565 (16 bit bmp) and 444 (12 bit bmp) format, or I should have to design different set of bitmaps for different format.

I also wonder if it is possible to use 16 bit 565 bmp as source to generate other format but I don't know if the lost of quailty is acceptable. I want to do so because the size of bmp data is about 600K now and it is keep growing.
You can easily downsample 24bpp bitmap to 16/15/12bpp
Only price is bigger file size which doesn't do anything on target device as it's cropped.
Using 16bpp will give you small quality loss on 24bpp systems. But it's often acceptable.. depends highly what you do.

But I encourage you to find a freeware .jpg library and use it instead... jpg files are MUCH smaller...
Don't use the bmp file format. Use TGA with RLE compression (very easy to code, source can be found on the net), or an 8 bit palettized format. That requires 1/3 (or 1/4 depending on the format) the storage per pixel compared to 24 bit.

Only problem with jpeg is it is a lossy algorithm.

Dan East
PNGS!!! PNGS RULE!!!
perhaps for some things, but not all.
we use uncompressed 16bit TGA's, and pack 'em with zlib. This results in a much beter compression than using compressed TGA's. We use the same "format" for compressing MOD's aswell, btw.

cryo
ever tried using compressed tgas and zlib?
I can guarantee you much better results on some types of images :-)
Is it worth noting that the quality loss going from 24Bit -> 16Bit is not too bad as most devices only have 16Bit displays anyway.
I've found unless the images are large and have a wide variety or colors (photos), they normally drop to 8-bit, 256 color or less TGA's with no quality loss at all, or very minimal.

-Brendan
I use 8bpp format all the way.
Quality loss from 24->16bpp is null as non PPC uses >16bpp screen. Quality loss might be visible when performing alpha-blending.. especially after few alpha-blendings :-)
golan_trevize_x · 18 Feb 2003, 00:35 UTC
Brendan means 8-bit palettized. So the colours themselves are still 16-bit depth, it's just there are only 256 of them.

BTW, I don't think PSP can save TGAs this way. Does anyone know of a good freeware image format converter?

Nathan
PSP can save any type of TGA you can think of. Hit Save As..., then click Options... in the file dialog.

Dan East
golan_trevize_x · 18 Feb 2003, 04:08 UTC
Dan,

Yeah, the only options I get are "16-bit or 24-bit", and "compressed or uncompressed".

I really don't think it's doing the palettized thing. I checked by measuring the size of the created file.
Perhaps you have to palettize the image, then save it as a TGA, where it will give you the option? It's been years since I've used PSP, so I'm probably wrong.
I know in Photoshop you first have to set the image from RGB mode to "Indexed"

-Brendan
under 8bpp I have meant palettized image of course.

PSP can save it, do like Brendan says.

In Photoshop you can also save 32bpp TGA images if needed for alpha-blending etc. (no idea if PSP supports it) - v.nice feature :-)
Unfortunetly before I found it I have created a program that puts together 24bpp and 8bpp greyscale tga into 32bpp one:-)
golan_trevize_x wrote:
Dan,

Yeah, the only options I get are "16-bit or 24-bit", and "compressed or uncompressed".

I really don't think it's doing the palettized thing. I checked by measuring the size of the created file.


I'm using PSP 6.02, and I see options for 8, 16 and 24 bit, Compressed or Uncompressed, in the Save As dialog.

Dan East
golan_trevize_x · 20 Feb 2003, 07:08 UTC
Thanks guys, Yeah I did find it after all!

Cheers!
Nathan
Thanks all.

It is great. The original size of my bitmaps are 1.6MB and it is now 260KB.

Special Thanks to Dan. I borrowed the zlib code from Pocket Quake and found that you are so kindly to do all required change and I can use it without any work.

MirekCz wrote:
ever tried using compressed tgas and zlib?
I can guarantee you much better results on some types of images :-)
Heh, as you kind see there are many different ways of doing this!

I also wonder if it is possible to use 16 bit 565 bmp as source to generate other format but I don't know if the lost of quailty is acceptable. I want to do so because the size of bmp data is about 600K now and it is keep growing.


Imho it depends on whether you are bothered about file size. For example in Repton I just used 565 raw data for the panel. This downgrades nicely to 444 on old iPAQs without me having to do anything. In fact to make it look nicer on 444 I think I just added some noise (which worked like stippling).

One the other hand we had a lot of photographic data for the inter-game screenshots, so I used a JPEG decompresser to 565 data for that. For a normal game if you have a lot of graphics and it isn't photographic and has lot of solid colours, PNG is probably the best.

I noticed that someone mentioned 16-bit TGA compressed using zlib. This is very close to being PNG if you think about it! (PNG is basically just 24-TGA zlib compressed with a header.)