Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def composite_images(images, renderer, magnification=1.0):
if data is not None:
x *= magnification
y *= magnification
parts.append((data, x, y, image._get_scalar_alpha()))
parts.append((data, x, y))
bboxes.append(
Bbox([[x, y], [x + data.shape[1], y + data.shape[0]]]))

Expand All @@ -104,10 +104,10 @@ def composite_images(images, renderer, magnification=1.0):
output = np.zeros(
(int(bbox.height), int(bbox.width), 4), dtype=np.uint8)

for data, x, y, alpha in parts:
for data, x, y in parts:
trans = Affine2D().translate(x - bbox.x0, y - bbox.y0)
_image.resample(data, output, trans, _image.NEAREST,
resample=False, alpha=alpha)
# Agg resampler assumes data is not premultiplied when dtype is uint8
_image.resample(data, output, trans, _image.NEAREST, resample=False)

return output, bbox.x0 / magnification, bbox.y0 / magnification

Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,7 @@ def test_image_composite_background():
ax.set_xlim(0, 12)


@image_comparison(['image_composite_alpha'], remove_text=True, style='_classic_test',
tol=0.07)
@image_comparison(['image_composite_alpha'], remove_text=True, style='_classic_test')
def test_image_composite_alpha():
"""
Tests that the alpha value is recognized and correctly applied in the
Expand Down
Loading