Skip to content

Conversation

@radarhere
Copy link
Member

Looking at the following code

im = im.convert("RGBA")
compare = im.convert("RGBA")
assert_image_similar(im, compare, 5)

it is readily apparent that it should read compare = compare.convert("RGBA").

Changing this does cause a file comparison to fail

"pal8nonsquare.bmp": "pal8nonsquare-v.png",

However, the test images have both pal8nonsquare-e.png and pal8nonsquare-v.png. Changing the test to compare against pal8nonsquare-e.png causes it to pass. https://github.com/jsummers/bmpsuite/blob/master/html/bmpsuite.html describes the difference as

Image editors can be expected to
leave the image “squashed”; image viewers should
consider stretching it to its correct proportions.

While that's not the clearest distinction for Pillow, this PR is just editing our test suite. Since we favour backwards compatibility, I'm going to choose pal8nonsquare-e.png, saying that Pillow is an 'image editor', since we currently leave the image squashed.

While I'm here, I'm also going to remove a number of comparison BMP images that we don't actually use, and the BMP HTML documentation.

@hugovk hugovk changed the title Fixed testing good P mode BMP images Fix testing good P mode BMP images Dec 10, 2025
@hugovk hugovk merged commit 6d493aa into python-pillow:main Dec 10, 2025
56 of 57 checks passed
@radarhere radarhere deleted the bmp branch December 10, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants