Whole file
jmcnamara/XlsxWriter
The author described this change as “image: fix issue with top-down DIB bmp”. It counts as a record because the check below fails on the code as it stood at 6f9d43568 and passes on 630854d95, with nothing else changed between the two runs.
Projectjmcnamara/XlsxWriter
Fix saved2026-07-02
Sharing licenceBSD-2-Clause · LICENSE.txt
Change size+4 −3
What the code was meant to do, written into the code itself as a save note
image: fix issue with top-down DIB bmp
The change
| 340 | 340 | return "gif", width, height, x_dpi, y_dpi | |
| 341 | 341 | ||
| 342 | 342 | def _process_bmp(self, data: bytes) -> Tuple[str, float, float]: | |
| 343 | - | # Extract width and height information from a BMP file. | |
| 344 | - | width = unpack("<L", data[18:22])[0] | |
| 345 | - | height = unpack("<L", data[22:26])[0] | |
| 343 | + | # Extract width and height information from a BMP file. The height can | |
| 344 | + | # be negative for a top-down bitmap so we take the absolute value. | |
| 345 | + | width = unpack("<l", data[18:22])[0] | |
| 346 | + | height = abs(unpack("<l", data[22:26])[0]) | |
| 346 | 347 | return "bmp", width, height | |
| 347 | 348 | ||
| 348 | 349 | def _process_wmf(self, data: bytes) -> Tuple[str, float, float, float, float]: |
The check that tells the two apart
fail→pass·xlsxwriter/test/comparison/test_image59.py::TestCompareXLSXFiles::test_create_file
Check file xlsxwriter/test/comparison/test_image59.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it6f9d43568435cbc6e4e962dd12cb204dfe1f8e4a
Broken version dated2026-05-19
Modulexlsxwriter.image
Units changedImage
Fingerprinte4b86ecf37ea1701
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.