The output looks correct through Windows viewer. The other lib just doesn't invert when the height is negative, so I will just need to check for this.
GOG works correctly. All unit tests are passing.
I am having an issue with BitmapFile.ReadIndexed on OPU 1.3.7 for well0001.bmp in art.vol.
The size of pixels does not match the image's height time pitch.
If I remove the exception, the image loads fine.
These are the passed in parameters:
VerifyPixelSizeMatchesImageDimensionsWithPitch(bitCount = 8, width = 32, height = 8608, pixelsWithPitchSize = 275458)
The first three parameters look correct based on the file property dialog in file explorer. I am not sure how to verify the last one.
I'm curious if this affects OP2Utility C++. The ported code looks to be identical for this function.
EDIT:
I studied the bitmap format a bit. This looks like a case where the BMP file is not formatted to spec. Windows/OP2 ignore this as there is enough information to correctly parse the file.
The BMP pixel container size is 2 bytes more than what it should be. It has two extra bytes of padding at the end that put it out of the 4-byte alignment specification. It is awkward, but it appears this just gets trimmed by most apps/libraries for rendering since the width/height properties will not use the full container.
For OP2UtilityDotNet, I am going to change the exception to only throw when the file's container size is too small for the width/height/bitCount. If there is extra fat at the end, it will pass validation. This appears to work successfully.
It may be worth considering doing this for OP2Utility C++ as well.
Commit for this change:
Fix for bmp files with excess padding.