Sign in to follow this  

Save additional info in a BMP

This topic is 3504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I'm working on an rpg here. But I got a question, i want to have a map file that contains a BMP as background, but i dont want the additional info and the BMP itself in a different file. Is there a way to get them in the same file? Thanks Robin

Share this post


Link to post
Share on other sites
Technically, you can put any data you like at the end of the file, or after the BITMAPINFOHEADER struct - that's what the bmOffBits member is for.

In practice though, doing this could cause the BMP to not load on some image viewers, and the information will be lost if you save the image.

Share this post


Link to post
Share on other sites
If you want to combine the image with data about the image, PNG has a chunk type for arbitrary data you can use, but alternatively you could just define your own file format for maps.

Share this post


Link to post
Share on other sites
BMP's don't have an official way to embed metadata. You can fake it like Evil Steve describes but there are so many crappy BMP loaders out there that you're virtually guaranteed to break some of them, plus you run the risk of MS extending the format again and having your stuff interfere with thiers.

Share this post


Link to post
Share on other sites
What kind of meta data?

If you need something per-pixel (such as collision map), you can use one of bitmap channels.

Then there's TIFF. That one was designed for extensibility, while it still remains editable and viable.

Share this post


Link to post
Share on other sites
I would argue that its bad form to try and shoe-horn your extra data onto a bitmap file, so rather than adding additional map data onto the BMP format, why not add the bitmap data to your own map format? Just have your map tool import a bitmap and include it in it's data set.

That way, you don't have to worry about what happens when your user decides to open the map in paint and, for whatever reason, save the file instead of simply closing it.

Share this post


Link to post
Share on other sites

This topic is 3504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this