2021-02-07 - Adjusting Animated Gif Images on Linux
As a reminder to myself, because I will do this once in a blue moon and won’t remember. If I need to manipulate an animated gif image on linux, Gifsicle is a useful tool.
On Ubuntu, install with
sudo apt install gifsicle
The two operations that I used
Cut frames from the end of the gif:
- Get info
gifsicle --info gif_file
Which will display the image number #0 - #n
- Specify the start and end frames. Below shows start at the first image and run to the nth image (100 in this case). Output the file to new_gif_file
gifsicle gif_file "#0-100" > new_gif_file
Resize:
- Resize the image to width 800px and maintain aspect ratio (_ will calculate the appropriate height to use to maintain aspect ratio), -o is the output filename
gifsicle gif_file --resize 800x_ -o new_gif_file
Further details on the Gifsicle website and useful information at the askubuntu forums which is where I found out about this tool.