How to create GIFs of images in Linux from the console

The fashion in social networks is animated Gifs, there are millions and with different purposes, some entertain us and others inform us, but without a doubt they have become the most efficient way to show something and have an incredible viral effect. For all this, we want to teach create Gif from images from console in an extremely simple and fast way, but with a fairly extensive parameterization, which will result in high quality and personalized animated gifs.create gif from images

To create GIFs of images in Linux we are going to use the imagemagick utility, which is super powerful and has a fairly simple syntax.

What is imagemagick?

Imagemagick It is the grouping of various utilities that allow us to perform many actions on images, it is open source and is normally used to display, edit or even convert images.

All these utilities are managed from the command line, being compatible with more than 100 formats and having a very short learning line, as well as a fairly simple syntax.

How to install imagemagick?

Imagemagick is present natively in various linux distros, but in case it is not installed by default in your operating system you can do it easily with some of the following commands:

Install imagemagick on Ubuntu, Debian and derivatives

Ubuntu, debian, deepin and derivative users can install using the following commands:

$ sudo apt-get install php5 php5-common gcc $ sudo apt-get install imagemagick

Install imagemagick on Arch Linux and derivatives

In arch linux and wrapper we can make use of the AUR repositories with the following command:

$yaourt -S imagemagick

Install imagemagick on CentOS / RHEL7, openSUSE, Fedora, and derivatives

With the help of yum we can install imagemagick in these distributions, just run the following commands

# [yum | dnf | zypper] install http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-libs-6.9.3-5.x86_64.rpm # [yum | dnf | zypper] install http : //www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-6.9.3-5.x86_64.rpm

Install imagemagick from source code

For all distros we can install imagemagick directly from its source code, for this we must execute this series of commands:

$ cd / opt $ wget http://www.imagemagick.org/download/ImageMagick.tar.gz $ tar xvzf ImageMagick.tar.gz $ cd ImageMagick-6.9.3 $ touch configure $ ./configure $ make $ make install $ ldconfig / usr / local / lib $ / usr / local / bin / convert logo: logo.gif

How to create GIF from images using imagemagick

The creation of animated gif with imagemagick is extremely simple, it is enough that we have in the same directory all the images that we want to put together to create the gif and execute the following commands:

$ cd / DirectoryWhereThe Images Are $ mogrify -resize 640x480 * .jpg * .png # This is to resize the images to the same size $ convert -delay 20 -loop 0 * .jpg * .png migif.gif #Delay represents the delay time

And with this series of fairly simple and intuitive commands we can create our animated gifs efficiently.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Martin said

    The potential of ImageMagick never ceases to amaze me. For a moment I thought that it was about making gifs by recording the console commands.

    If you know of an application with a graphical interface to create meme-like images in Linux, it would be good to know it. Thank you very much for the tutorial, I am especially interested in creating memes. Congratulations on the blog, I always read it, keep it up!

  2.   Thulium said

    Imagemagick is fine but for animated gif I like the combination of ffmpeg and gifsicle better. Ffmpeg to create from images or videos, and gifsicle to optimize, although it allows creating them as well.
    It is also available in termux, so it is a very good option for the android mobile.

    1.    3 said

      Hi, good morning

      I ask Tulio or those who write articles on this blog to please make a tutorial on how to use ffmpeg and gifsicle to create and optimize gifs or what are the best methods to create gifs from videos.

      regards

  3.   tkto said

    I follow the indicated procedure and when I write
    $ make
    $ make: **** No target specified and no makefile found. High.

    What do you suggest I do, thank you.

  4.   3 said

    Hi, good morning

    Thanks for the tutorial ... In this part of the command -loop 0 weight what does it refer to? In what order does this command take the images?

    How do I make a gif from a video (for example from the second such to the second such)?

    Greetings and I await your response soon

  5.   David figueroa said

    Good morning, It catches my attention but I don't quite understand where I should place the name of the image to resize it. Will you have a more explained tutorial?

  6.   570n3d said

    Genial!