|
-
Mar 20th, 2016, 02:52 PM
#6
Re: Many small bitmaps
 Originally Posted by Tanner_H
The bigger problem here seems to be the file size involved, which is easily mitigated by using a format other than BMP.
For best results, you'd want to combine multiple images into a single sprite sheet, then store the sprite sheet in a compressible format like PNG. This changes the way you retrieve the individual images, obviously, but I wouldn't be surprised if the size savings approached ~80-90%.
I just now saved one of the bitmaps as a png file (using Paint) and then ran it through pngoptimizer.
Original bmp: 5238 bytes
"Clean" png: 3072 bytes
That's nice, but not nearly enough to bother with, I don't think. Right now the graphics folder (tree) with the 2837 bitmaps is 30,969,348 bytes. If that sample compression stays true, they'd shrink to 18,163,008 bytes. That's still much too big to stuff into an exe, and if we're talking about an external data file, the size on disk is largely irrelevant.
 Originally Posted by dilettante
Compression might still be an answer though, and almost always worth exploring. Consider converting each small image to PNG or even GIF if you can do it without loss of fidenlity.
That's the initial thinking they're considering. It seems inelegant to me to zip/unzip bitmaps as needed instead of having a resource file you can LoadPicture from.
Then you can go back to looking at resources, or develop your own ad-hoc file format. For example maybe just concatenate the compressed image files into one file, creating a directory (offset and length of each image in the BLOB), then append the BLOB to the end of this directory block.
That sounds like something I would do, but I'm not sure they'd be into this.
Then if you normally use only a subset of this set of images random I/O can be used to retrieve only the ones you need. If you normally use most of them then the imagemap approach may make more sense.
Only a small subset, yes. Any given "session" will only use maybe a couple hundred, tops.
It's also worth pointing out that new sets of images (~40 at a time) get added occasionally, so it would be ideal if whatever solution supported easy maintenance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|