Saved BMP is quite huge
Blitz3D Forums/Blitz3D Beginners Area/Saved BMP is quite huge
| ||
Hi people. I wanted to learn about 2D scrolling so I started playing around and after a few weeks I ended up with a very basic two player split screen that my daughter and I have alot of fun with. Digging , building some basic structures like walls, floors , ladders and running around shooting missiles at each other. To get to the point, I use a map 4000 by 3000 pixels and saving a BMP this size with B3D uses 34.3 meg. I initially made the map in a paint program and saved it in 256 color mode and that was 11.4 meg. The paint program could also save as 101 k JPG and 24.7 k PNG. Can B3D save a BMP in 256 color mode or is there some other way to reduce the save file size without reducing the map size? Thanks. |
| ||
Bitmaps in 32bit colour mode are always going to be large, since they are usually uncompressed with the size in bytes roughly equal to "width * height * 4 bytes" in size. In memory unless you use compressed textures the image will always take up that size as well. There may be something in the code archives that allows you to save to png or jpg but I couldn't find any when I just had a look. Alternatively you could save in a format of your own devising with your own method for compression, even run length encoding will be shorter than a standard bmp most of the time. |
| ||
Alternatively use a tiling system... |
| ||
Thanks Matty. I should have mentioned that I am only at an early stage of learning so writing my own compression routine is out of my range at the moment. Your point about memory usage is well taken. I will want to use even bigger maps in other projects so breaking them up in to tiles does seem the way to go. Thanks again. |
| ||
Yes, create a tile set to create your maps. It's the only way to fly. :) |
| ||
While I think a tile set is the way to go for creating game maps, if you need to save large images, you could use this: http://www.blitzbasic.com/codearcs/codearcs.php?code=1732 It's a wrapper for the FreeImage library, which can save to PNG (and several other things too). I've never used it myself, but it looks simple enough. Given that Blitz3D uses FreeImage internally anyway, I'm not sure why it doesn't actually provide the ability to save to PNG itself, but... I'm sure there's some reason. |
| ||
Thanks for the replies. I have had a bit of a look at the FreeImage stuff and I'll need to have a BIG look at it before I understand it properly. I'll first look around the forum to see how others have used it. It will cut down on my study time. : ) Thanks for your help. |