Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Description
Bug summary
PR#23371 changed the defaultanimation.convert_args
to["-layers", "OptimizePlus"]
in order to better compress gif animations. However,animation.convert_args
is also used byImageMagickFileWriter
to save frames as individual images (e.g., as png). Using-layers OptimizePlus
in this case causes unintended cropping for some of the frames!
Code for reproduction
frommatplotlibimportanimationfig,ax=plt.subplots()x=np.arange(0,2*np.pi,0.01)line,=ax.plot(x,np.sin(x))defanimate(i):line.set_ydata(np.sin(x+i/10.0))# update the datareturnline,ani=animation.FuncAnimation(fig,animate,np.arange(1,10),init_func=None,interval=25)Writer=animation.writers['imagemagick_file']writer=Writer()#writer = Writer(extra_args=[]) # Workaround to disable -layers OptimizePlusani.save('ani.png',writer=writer)
Actual outcome
Frame (ani-0.png) 0 is correct, while frames 1-8 (ani-1.png through ani-8.png) are cropped.
Expected outcome
None of the frames should be cropped in the resulting images. See commented workaround in above code example.
Additional information
No response
Operating system
No response
Matplotlib Version
3.6.1
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
pip