Hacker News new | past | comments | ask | show | jobs | submit login

What's gross about BMP, it's one of the easiest image formats out there.



my limited understanding is it's basically just raw RGB values as binary, with just enough metadata to put it on the screen. BMP from my understanding is, like most things microsoft from that era, just a memory dump of the structure/array holding the image in memory.

I wonder if grandparent meant something else, but i don't know enough this instant to guess at what other format?


Haha, if only. Read the wiki article on BMP sometime. There's RLE, huffman coding, all kinds of bitdepths and channel masks. Configurable halftoning algorithms. Embedded JPEGs and PNGs? 64-bit BMPs in some kind of fixed point format? And that's on top of the usual Microsoft DWORD BITMAPV2INFOHEADER; struct-dump gunk.

The real kicker is it's not even useful. Just say "unsupported" to everything that isn't a dumb RGB dump and no one will ever notice!


Embedded png was vista+ iirc (that would be BITMAPV4INFOHEADER+), and is used primarily in .ico files to contain multi-resolution icons.

I don't think I ever saw a embedded jpeg.


Yeah, when I tried to implement BMP I couldn't even find a good specification. In the end it was easier to write a PNG loader/writer than deal with BMP. I've also got much better compatibility with other software.

The writer was so trivial that even with the need to encapsulate the uncompressed data in a Deflate compatible bitstream it was just easier than trying to do a BMP output.

I've even released my code under public ___domain if someone is interested: http://public-___domain.advel.cz/


huh, i've been living under a misapprehension for a very long time. Now that you mention it i do remember run length and Huffman. I wonder if i am confusing it with a different file format that is basically just the RGB values with the WxH metadata?


You can create BMP files like that - I wrote some image generators that do that and they render fine in all image viewers. But the spec also supports much more, so if you're writing a BMP viewer then things get hairy.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: