Skip to content

Commit

Permalink
proposed fix for transparency issue matplotlib#27173
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobRing committed Nov 30, 2023
1 parent 88e4a43 commit 8099667
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,11 @@ def func(current_frame: int, total_frames: int) -> Any

def _pre_composite_to_white(color):
r, g, b, a = mcolors.to_rgba(color)
return a * np.array([r, g, b]) + 1 - a
if type(writer) == PillowWriter:
print("no true transparency using pillow")
return a * np.array([r, g, b]) + 1 - a
else:
return np.array([r, g, b, a])

savefig_kwargs['facecolor'] = _pre_composite_to_white(facecolor)
savefig_kwargs['transparent'] = False # just to be safe!
Expand Down

0 comments on commit 8099667

Please sign in to comment.