Skip to content

Commit

Permalink
replace tostring_rgb with buffer_rgba for compatibility with mpl 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
guiwitz committed Dec 16, 2024
1 parent 17a00ad commit ad5e78f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions microfilm/microanim.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,10 @@ def save_movie(anim_object, movie_name, fps=20, quality=5, format=None):

for t in range(anim_object.max_time):
anim_object.update_animation(t)
#self.ax.figure.canvas.draw()
anim_object.fig.canvas.draw()
#buf = np.frombuffer(self.ax.figure.canvas.tostring_rgb(), dtype=np.uint8 )
buf = np.frombuffer(anim_object.fig.canvas.tostring_rgb(), dtype=np.uint8 )
#w,h = anim_object.ax.figure.canvas.get_width_height()
#w,h = anim_object.fig.canvas.get_width_height()
buf = np.frombuffer(anim_object.fig.canvas.buffer_rgba(), dtype=np.uint8 )
w,h = map(int, anim_object.fig.canvas.renderer.get_canvas_width_height())
buf.shape = (h, w, 3)
buf.shape = (h, w, 4)
writer.append_data(buf)

writer.close()
Expand Down

0 comments on commit ad5e78f

Please sign in to comment.