Skip to content
Prev Previous commit
Next Next commit
Fix ability to specify scalar alpha to Agg draw_image
  • Loading branch information
ayshih committed Aug 26, 2026
commit 730113449976c6a5914d69cf6563734ea0b597de
2 changes: 1 addition & 1 deletion lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ def draw(self, renderer):
# actually render the image.
gc = renderer.new_gc()
self._set_gc_clip(gc)
gc.set_alpha(self._get_scalar_alpha())
gc.set_blend_mode(self.get_blend_mode())
gc.set_url(self.get_url())
gc.set_gid(self.get_gid())
Expand All @@ -659,6 +658,7 @@ def draw(self, renderer):
and self.get_transform().is_affine):
im, l, b, trans = self.make_image(renderer, unsampled=True)
if im is not None:
gc.set_alpha(self._get_scalar_alpha())
trans = Affine2D().scale(im.shape[1], im.shape[0]) + trans
renderer.draw_image(gc, l, b, im, trans)
else:
Expand Down
1 change: 0 additions & 1 deletion src/_backend_agg_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ PyRendererAgg_draw_image(RendererAgg *self,
x = mpl_round(x);
y = mpl_round(y);

gc.alpha = 1.0;
self->draw_image(gc, x, y, image);
}

Expand Down