Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 841b3a6

Browse filesBrowse files
committed
Drop alpha channel when saving comparison failure diff image.
We drop (for the better or the worse) the alpha channel when *comparing* the images (in `compare_images`), but not when saving; thus, a comparison failure where additionally the reference has no alpha but the generated image has an alpha channel would so far raise a spurious "image sizes do not match" when trying to save the diff image, rather than actually saving the diff image as expected. Noted while running the Matplotlib test suite with mplcairo.
1 parent 3719994 commit 841b3a6
Copy full SHA for 841b3a6

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎lib/matplotlib/testing/compare.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/compare.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ def compare_images(expected, actual, tol, in_decorator=False):
422422

423423

424424
def save_diff_image(expected, actual, output):
425-
expectedImage = _png.read_png(expected)
426-
actualImage = _png.read_png(actual)
425+
expectedImage = _png.read_png(expected)[..., :3]
426+
actualImage = _png.read_png(actual)[..., :3]
427427
actualImage, expectedImage = crop_to_same(
428428
actual, actualImage, expected, expectedImage)
429429
expectedImage = np.array(expectedImage).astype(float)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.