Make animation in linux

How do I create an animated gif from still images (preferably with the command line)?

I want make a .gif animated picture from a given set of .jpg pictures. I would prefer to do it from the command line, so command line tools would be very welcome.

7 Answers 7

You can use ImageMagick package. Install it using the command:

sudo apt-get install imagemagick 

Now you can create a gif from number of pictures( jpg ) using:

convert -delay 20 -loop 0 *.jpg myimage.gif 

ImageMagick users will likely also want: -deconstruct . I have also found that ImageMagick is very memory hungry, see benchmarks: askubuntu.com/a/1102183/52975

To complete @Maythux answer:

To avoid generating a very large file, you can use -resize option:

In my case, I have 4608×3456 images and the generated gif was more than 300M for 32 images

convert -resize 20% -delay 20 -loop 0 *.jpg myimage.gif 
convert -resize 768x576 -delay 20 -loop 0 *.jpg myimage.gif 

Take care of *.jpg

*.jpg sucks a bit when dealing with numeric values, you may generate a gif with unsorted pics.

$ ls|cat 21-33-26_1.jpg 21-33-26_10.jpg //  

As the shots were taken very quickly (10/s) they all have the same modification time and you can't trick using ls -t for example. On ubuntu you can use ls -v instead, something like:

convert -resize 768x576 -delay 20 -loop 0 `ls -v` myimage.gif 

Sorting numerically is quite tricky on Mac OS X though, I guess you'll need to build a custom script.

You can avoid your *.jpg issue by forward padding numbers with zeros. "01.jpg" instead of "1.jpg", and so on. If you get to triple digits, then "001.jpg", "010.jpg", etc.

There are several ways around the filename sequence problem. Including find , sort , brace expansion, and so on. The ls tool is notoriously unsuitable for this kind of thing. Use find . There's a bit of a learning curve, but it's worth it.

If the input has a transparent background, I would also recommend the -dispose Background option. (I realize OP's post is about jpeg images which cannot have transparent backgrounds, but just in case anyone finds this answer via Google, like I did). By the way, regarding the ls sorting, you could always do some bash script hacking inline, e.g.: $(for f in `seq 0 10`; do printf "21-33-26_$f.jpg\n"; done)

ffmeg solution + test data

As of Ubuntu 18.10, ffpmeg 4.0.2-2, ImageMagick 6.9.10-8, I have found that ffmpeg is much faster than ImageMagick, and uses much less memory.

The simplest conversion command is:

ffmpeg \ -framerate 60 \ -pattern_type glob \ -i '*.png' \ -r 15 \ -vf scale=512:-1 \ out.gif \ ; 

You can get my test data with:

wget -O opengl-rotating-triangle.zip https://github.com/cirosantilli/media/blob/master/opengl-rotating-triangle.zip?raw=true unzip opengl-rotating-triangle.zip cd opengl-rotating-triangle 

The important ffmpeg options I want to highlight are:

  • -pattern_type glob : convenient way to select images
  • -framerate 60 : assume 60 FPS on input images, and output the same FPS. ffmpeg cannot know otherwise, since there is no FPS data is in images as there is is in video formats. The 256 input frames take about 4 seconds to finish. -r 15 : optional. Pick one every 4 images so reduce size ( 4 == 60 / 15 ). With it, identify out.gif says that the GIF contains only 64 frames. It still takes 4 seconds to play, so the delay is altered to make things match.
  • -vf scale=512:-1 : optional. Set the width, scale height proportionally, usually to reduce size and save space.

ImageMagick vs ffmpeg benchmark

To get ImageMagick to work, I first had to modify its disk and memory limits at /etc/ImageMagick-6/policy.xml as explained at: https://superuser.com/questions/1178666/imagemagick-convert-quits-after-some-pages

/usr/bin/time -v convert *.png -deconstruct -delay 1.6 out-convert.gif /usr/bin/time -v ffmpeg \ -framerate 60 \ -pattern_type glob \ -i '*.png' \ out-ffmpeg.gif \ ; 

The commands were constructed to produce outputs that are as close as possible to make the comparison valid:

  • /usr/bin/time -v : used to find the maximum memory usage as explained at: https://stackoverflow.com/questions/774556/peak-memory-usage-of-a-linux-unix-process
  • -deconstruct : GIF images can contain just the minimal modified rectangle from the previous frame to make the GIF smaller. ffmpeg calculates those diffs by default, but ImageMagick does not, unless -deconstruct is used. You will basically want to use that option every time with ImageMagick. We can observe the difference with:
out.gif[0] GIF 1024x1024 1024x1024+0+0 8-bit sRGB 256c 16.7865MiB 0.010u 0:00.010 out.gif[1] GIF 516x516 1024x1024+252+257 8-bit sRGB 256c 16.7865MiB 0.010u 0:00.010 out.gif[2] GIF 515x520 1024x1024+248+257 8-bit sRGB 256c 16.7865MiB 0.010u 0:00.010 

The output GIFs have about the same size and look visually identical.

Elapsed (wall clock) time (h:mm:ss or m:ss): 0:56.16 Maximum resident set size (kbytes): 2676856 
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.41 Maximum resident set size (kbytes): 97172 
  • ImageMagick used 2.6Gb of RAM and took about 1 minute
  • ffmpeg used 100Mb of RAM and took 4 seconds

Test hardware: Lenovo ThinkPad P51 laptop, Intel Core i7-7820HQ, 32GB(16+16) DDR4 2400MHz SODIMM, 512GB SSD PCIe TLC OPAL2.

Источник

Top 6 Open-Source Animation Tools

Top 6 Open-Source Animation Tools

Animation is the demand of the times. Since its inception in 1908, animators are being approached to draw various illustrations and drawings. In the current century, animation is being adapted not only for cartoons and movies but for doing simple tasks such as animating a company’s logo. 2D and 3D animation are being adopted in numerous paradigms that actually portray the concept of bringing an idea to life. Many animation tools have been developed since that ease the task of animating logos and making other simple and complicated animations. However, very few of them are actually efficient and open-source at the same time. Open-source software products provide an additional ground for extensions, improvements, and modifications as per user’s demands and requirements. Therefore such tools extend the overall capabilities of a software product. In this article, we discuss the best tools for animation that are open-source and compatible with Linux and other leading operating systems.

Blender

Blender is a free, open-source, and cross-platform compatible animation tool that comes feature-packed with the most enhanced functionalities. The platform allows creating both 2D and 3D animation utilizing a list of features and capabilities incorporated in the efficient tool. Some of its features include capabilities such as rendering, modeling, animation, VFX, simulation, pipeline, game creation, video editing, scripting, customization, etc. Blender, though free, offers paid subscriptions as well. The tool is equipped with all the necessary and potential features required for drawing any animation or portraying any illustration. From cartoons to logos, Blender provides functionalities and a platform for all the animators.

Pencil 2D

The renowned tool for creating 2D animations, Pencil was released in 2005 under the GPL license. The tool is free, open-source, and cross-platform compatible animation software. Pencil 2D comes equipped with a list of features such as the ability to draw and support raster and vector workflows, allows easily animating hand-drawn illustrations, bitmap artwork, etc. The tool allows a seamless frame-by-frame animating experience and provides a simple layout that enhances the user experience. All the users, from beginners to professionals, are most seamlessly synchronized with the tool’s efficient features and user experience and are able to create the most intricate animation utilizing the enhanced list of advanced features provided in the tool.

Gimp

Gimp, an acronym for GNU Image Manipulation Program was developed by the experts at the Gimp Development Team. Gimp is renowned for providing a most simple platform for basic animation along with providing an efficient photo editing tool for Linux. Gimp is free and open-source software and is also cross-platform compatible. The tool can be used for Linux, macOS, Windows, FreeBSD, Solaris, and AmigaOS 4 platforms. Gimp offers its users many functionalities such as enhanced coloring feature that includes image manipulation program, 2D animation, frame-by-frame animation, simplistic and a straightforward UI, hand-drawn animation, basic animation program, etc.

Synfig Studio

Synfig Studio is another free, open-source, and cross-platform compatible animation tool that comes under the GPL license. With Synfig Studios, the users and animators are capable to illustrate and draw 2D animations. However, the tool is also capable and comes equipped with features that allow creating basic 3D animations. The tool provides a list of enhanced features and capabilities such as vector tweening, layers and filters, bones, animation, bitmap artwork, advanced controls, and the list goes on. The easiest and simple animation software is the go-to animation software of many animators across the globe.

TupiTube

As interesting as its name, the TupiTube was developed and designed by a startup company named MaeFloresta, which originated in Columbia. The tool provides basic capabilities and features for creating and drafting 2D animations and illustrations. The free, open-source, and cross-platform compatible tool comes under the GPL license. The tool was designed for children, amateur artists, and animators and is hence one of the simplest and most straightforward animation software for creating animations and cartoons or logos, etc. the tool provides a list of features such as rotoscoping capabilities, stop motion functionality, frame-by-frame animation, cut-out animation, hand-drawn animation, virtual assist, etc.

Krita

Released in 2005 by Krita Foundation and KDE, i.e., the renowned free and open-source software developers, Krita is a cross-platform compatible tool for animation and also for photo editing. The tool can be used for users across Windows, macOS, Linux, Android, and Chrome OS platforms. Krita offers its users a vast list of features and tools. Krita comes equipped with brush stabilizers, brush engines and instant access to the 10 loaded brush presets, adjustable adjust brush size, resource manager, ability to set foreground and background color display, pop-up palette, wrap-around mode, drawing assistant, mirroring tools, OpenGL enhanced with the pop-up palette, adjustable previewing functions such as zoom, mirroring, rotating, etc.

Closing Remarks

Animation tools are being used by everyone, from children to students to the professionals creating animation movies, everyone requires an efficient animation tool that can illustrate their thoughts. In this article, we have provided a list of the top 6 best free, open-source, and cross-platform compatible animation tools that are widely used and adapted across the world. These tools are Blender, Pencil 2D, Gimp, Synfig Studio, TupiTube, and Krita. All the discussed tools along with providing efficient animation features and functionalities, ensure the easiest and user-friendly platform as well, and hence are widely adopted by individuals and companies as well.

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.

Источник

Читайте также:  Linux live usb images
Оцените статью
Adblock
detector