Topic: Bug loading some BMP files in Image Analyzer
I notice it doesn't work with some BMP image files. Those files have a negative value for image height, in the BitmapInfoHeader part of the file. You see, the height field being a negative number actually means that the image is flipped vertically compared to normal BMP image data orientation (first bytes of image data being at the top of the image, instead of at the bottom of the image). BMP is a bit unusual compared to other image file formats. The BMP file standard's NORMAL orientation is with the top of the image being stored LAST. So in order to be more similar to other image formats (top line of pixels stored FIRST), you need to have a negative value for height. The negative value for height, signals the fact that the BMP file stores the top line of pixels first. All of the image processing software I write, for example, ALWAYS uses a negative value for image height when saving a BMP file, this is so that the actual image data is stored in a more useful orientation, making it much easier, with fewer lines of code, to convert between BMP files that my software saves, and other formats (most of which always store the top line of pixels first in the file). Furthermore, its easier to design software that always has the top pixels first in the pixel array, and this is how my brain thinks, when writing software. Image top=first bytes, image bottom=last bytes, so quite naturally, I write code that populates a byte array in this order, and I save that byte array to a BMP file when I want to store the image, always making sure that the Height field in the BMP file's BitmapInfoHeader is always negative.
Unfortunately, Image Analyzer has a problem loading such BMP files, when the height value is negative. While it does properly create an image window with the correct dimensions, the loaded image is completely black. This is incorrect behavior. The image window should instead contain the image that was stored in the BMP file. And that means that BMP files saved by all of the software that I've written, won't load in Image Analyzer. I have to first load them into another program (such as MS Paint, or Gimp) and then re-save them, so that they get around this bug in Image Analyzer. And yes it is a bug, because a properly working BMP file loader routine in a program will check the sign of the Height field in the header, so that it can handle either orientation of the image data.