Hi, a while back for some practice I wrote a .bmp file reader… it worked perfectly or so i thought. The thing is it works when it’s reading height=2^n width=2^n, but when width=height=some odd number… it doesn’t load them up right.
After some debugging I found out that
bitsPerPixelWidthHeight != (image size defined in the file)
[my 5x5 picture’s size was 80 bytes, instead of 75]
but it’s supposed to be!! And when I displayed the contents of the file byte by byte, i found a bunch of 0s in places… but there seemed to be a pattern for zeros… any ideas? Is there junk data in bmp image?
That kind of filler data is common in many types of files. It just requires you to be strict about reading in the files as precisely as the header indicates.