Search code examples
pythonimagemagickgiftrimanimated-gif

Animated GIF trim whitespaces using PIL


Using the following link: https://stackoverflow.com/a/10616717/8166528, I can trim the whitespaces, however this method takes the first frame and trims it. So the animated gif will lose the remaining frames.

Is there a way to trim the whitespaces of an animated gif?

Added picture: https://i.sstatic.net/KMvK3.gif


Solution

  • I got it working using ImageMagick like @fmw42 suggested:

    convert input.gif -trim +repage output.gif