How to resize an animated GIF image in Linux

Slowly but steadily, animated GIFs have become a kind of standard for Internet-based communications. As you'd have probably seen, people use GIFs mostly to express their emotions as well as to add humor to their responses when communicating with each other.

Resize animated Gif

While there's no doubt that's a popular use of GIFs, the image format is extremely popular in technical circles as well, as it's used to quickly convey, say, how to access a feature in a particular software.

The only problem with animated GIFs is that they are a bit heavy (size-wise), and if you try resizing them using your standard image editor, you'll most likely end up with a non-animated GIF image. If you are looking for a way through which you can easily resize animated GIFs without losing the animation part, you've come to the correct place, as here, we'll explain a couple of ways to do that.

Before we move ahead, keep in mind that all the instructions and commands mentioned in this tutorial have been tested on Ubuntu 14.04.


Way 1 - Using Convert command

The Convert command is part of the Imagemagick package. If the package isn't already installed on your machine, you can install it using the following command:

sudo apt-get install imagemagick

Now, to resize an animated GIF, all you have to do is to run the following two commands:

convert input.gif -coalesce temp.gif
convert -size [orig-size-of-input-gif] temp.gif -resize [target-size] resized.gif

For example, in a given case, the second command could be:

convert -size 200x200 temp.gif -resize 50x50 resized.gif


Way 2 - Using Gifsicle utility

Gifsicle is basically a dedicated command-line tool for creating, editing, and getting information about GIF images and animations. You can install it using the following command:

sudo apt-get install gifsicle

Once the utility is installed, you can use it for resizing purposes in the following way:

gifsicle input.gif --resize [target-size] > resized.gif

So, an example could be:

gifsicle input.gif --resize 50x50 > resized.gif

That's it.

Leave a Comment