Let us quickly see how to compress GIF files using an offline solution. There are lots of online solutions available but I just wanted to share this simple command line tool called gifsicle which is going to help us to quickly compress the GIF files without you connecting to the internet.
Compress GIF Files Using Gifsicle
- Visit the Gifsicle website.
- Under Prebuilt binaries section you can find the appropriate executable or binary file for your operating system. Since I am using a windows system and my operating system is 64-bit, I have downloaded the gifsicle_1.71.win64.zip file which is around 130 KB in size.
- Extract the zip file contents.
- You should see gifsicle.exe file. Now in order to use this we need to open a command prompt and the easiest way to do that is – hold the SHIFT key and right click inside the folder and you should see “Open command window here” option which will open the command prompt in the location where your gifsicle.exe file is present.
- Copy the gif file that you want to compress and place it inside the same folder where gifsicle.exe file is present. For example, I have placed a Demo.gif file in the same folder where the gifsicle.exe file is present, refer the below screenshot.
- Now go to the command prompt that you had opened before and type the below command
gifsicle -O2 –colors 256 Demo.gif > New.gif
- My Demo.gif file size was 4.35 MB earlier and the New.gif file size after compressing it was 2.84 MB
Note: Sometimes reducing the colors value can also drastically reduce the size of the file but it may also impact the overall GIF file output.
Gifsicle Cool Stuff
- Explode option in gifsicle is also quite interesting, it splits the number of files used for building the GIF file.
gifsicle –explode <filename.gif>
- You can get information on Color Table, number of images used and information on each of images/frames that were used to build the GIF using the below command.
gifsicle.exe -I <filename.gif>
To understand more about the syntax and the other options available in gifsicle, please read their documentation page.
Compress GIF Files Online
If you are looking for an online solution then I would recommend the below two websites:
- Gfycat – This website stores the compressed GIF file in its server, which you can share/embed wherever you want.
- Compressor.io – This website in addition to GIF also takes up PNG, SVG and JPEG files for compression.