Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

2 votes
2 answers
756 views
How can I convert an animated gif to indivual frames and then back again to animated gif?
I want to manually modify an animated gif. So I'm trying to convert it to individual (editable) frames, after which I can draw my modification and then re-assemble the frames. First I convert a 31 seconds long mp4 to animated gif : ``` ffmpeg -i Daisies.mp4 -r 15 -vf scale=512:-1 -ss 00:00:03 -to 00...
I want to manually modify an animated gif. So I'm trying to convert it to individual (editable) frames, after which I can draw my modification and then re-assemble the frames. First I convert a 31 seconds long mp4 to animated gif :
ffmpeg   -i Daisies.mp4   -r 15   -vf scale=512:-1   -ss 00:00:03 -to 00:00:06   DaisiesOK.gif
This animated gif is OK. Then I convert this animated gif to individual frames :
magick convert DaisiesOK.gif Daisies.png
The first frame looks OK, except it's in 256 colors, but the next ones are very pale, full of transparent pixels. These frames to animated gif :
magick convert -delay 20 -loop 0 *.png Daisies.gif
Gives a very ugly video, the daisies have white "shadows", the place where they started from (they're swaying) stays imprinted with white daisy edges. If I try to use jpeg instead of png, it's even worse, most of the video is just black. How can I extract the frames preserving all the color information? Does the problem come from imagemagick or from ffmpeg?
Alain Reve (123 rep)
Feb 9, 2025, 05:50 PM • Last activity: Feb 13, 2025, 11:26 AM
4 votes
4 answers
1102 views
How can one count how many pixels a GIF image has via command line?
I use Ubuntu. I have a large number of GIF images. How can one count how many pixels a GIF image has via command line?
I use Ubuntu. I have a large number of GIF images. How can one count how many pixels a GIF image has via command line?
Franck Dernoncourt (5533 rep)
Jul 7, 2024, 02:37 PM • Last activity: Jul 17, 2024, 09:30 PM
2 votes
1 answers
1040 views
ImageMagick refused to convert the animated GIF and killed the process silently due to CPU
I tried with these solutions below, but unsuccessfully: - [ImageMagick convert problem, command killed or silently exits](https://askubuntu.com/questions/576717/imagemagick-convert-problem-command-killed-or-silently-exits) - [Using disk for processing of huge images](https://www.imagemagick.org/disc...
I tried with these solutions below, but unsuccessfully: - [ImageMagick convert problem, command killed or silently exits](https://askubuntu.com/questions/576717/imagemagick-convert-problem-command-killed-or-silently-exits) - [Using disk for processing of huge images](https://www.imagemagick.org/discourse-server/viewtopic.php?t=33434) - [ImageMagick convert out of memory](https://stackoverflow.com/questions/48423113/imagemagick-convert-out-of-memory) - [ImageMagick using more than 2GB of memory to convert PDF files](https://stackoverflow.com/questions/15384879/imagemagick-using-more-than-2gb-of-memory-to-convert-pdf-files) My animated GIF has 13.5MB. My computer has 16GB RAM memory. I have 8 CPUs of AMD Ryzen 7 2700X. I received the error:
$ convert -limit memory 2MB -limit map 2MB -limit area 1000MB -delay 2 -loop 0 "Bug do pagamento.gif" Extraídos/bug.png
convert: unable to write pixel cache '/tmp/magick-RSymnnZRmXzueDXGI3ehEtIiUkBcymGa': Sem espaço livre no dispositivo @ error/cache.c/WritePixelCachePixels/5830.
convert: corrupt image `Bug do pagamento.gif' @ error/gif.c/DecodeImage/505.
convert: corrupt image `Bug do pagamento.gif' @ error/gif.c/ReadGIFImage/1368.
convert: no images defined `Extraídos/bug.png' @ error/convert.c/ConvertImageCommand/3285.
zsh: exit 1     convert -limit memory 2MB -limit map 2MB -limit area 1000MB -delay 2 -loop 0 
convert -limit memory 2MB -limit map 2MB -limit area 1000MB -delay 2 -loop 0   2,75s user 2,73s system 99% cpu 5,505 total
Using LANG=C:
$ LANG=C convert -limit memory 2MB -limit map 2MB -limit area 1000MB -delay 2 -loop 0 "Bug do pagamento.gif" Extraídos/bug.png
convert: unable to write pixel cache '/tmp/magick-RlftdgBD6MZCwArQzkuz5QI-kJtui7yk': No space left on device @ error/cache.c/WritePixelCachePixels/5830.
convert: corrupt image `Bug do pagamento.gif' @ error/gif.c/DecodeImage/505.
convert: corrupt image `Bug do pagamento.gif' @ error/gif.c/ReadGIFImage/1368.
convert: no images defined `Extraídos/bug.png' @ error/convert.c/ConvertImageCommand/3285.
zsh: exit 1     LANG=C convert -limit memory 2MB -limit map 2MB -limit area 1000MB -delay 2  
LANG=C convert -limit memory 2MB -limit map 2MB -limit area 1000MB -delay 2    2,84s user 2,60s system 99% cpu 5,454 total
- tmpfs:
LANG=C df -h /tmp
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           7,9G  7,2M  7,9G   1% /tmp
Oo'- (255 rep)
Aug 18, 2020, 09:55 PM • Last activity: Feb 12, 2023, 06:37 PM
23 votes
4 answers
53881 views
webp animation to gif animation (cli)
I was surprised today to find apparently how difficult it is to go from a `webp` animation to `gif` animation. My `GIMP 2.8.22` and `ImageMagick 7.0.7-21` on `linux 4.14.13-1-ARCH` don't seem to support the format, and the only tool available in repos seem to be `libwebp 0.4.1` which includes a deco...
I was surprised today to find apparently how difficult it is to go from a webp animation to gif animation. My GIMP 2.8.22 and ImageMagick 7.0.7-21 on linux 4.14.13-1-ARCH don't seem to support the format, and the only tool available in repos seem to be libwebp 0.4.1 which includes a decode tool that lets you extract individual frames to some image formats, none of them being gif (It's a licensing problem maybe?) Anyway, I used the following script: #!/bin/bash DELAY=${DELAY:-10} LOOP=${LOOP:-0} r=realpath $1 d=dirname $r pushd $d > /dev/null f=basename $r n=webpinfo -summary $f | grep frames | sed -e 's/.* \([0-9]*\)$/\1/' pfx=echo -n $f | sed -e 's/^\(.*\).webp$/\1/' if [ -z $pfx ]; then pfx=$f fi echo "converting $n frames from $f working dir $d file stem '$pfx'" for ((i=0; i /dev/null Which creates a gif animation from the extracted frames of the file supplied in the first argument. I tried it on this file and the resulting file was kind of artifacty. Is it proper form to post in this forum for suggestions of improvement of the procedure/invocations? And: If there are custom tools for this conversion, please share your knowledge! :)
lash (811 rep)
Jan 26, 2018, 04:02 AM • Last activity: Jan 18, 2023, 12:38 PM
6 votes
3 answers
7685 views
Merge three .gif animations
I have 3 .gifs animations and I just want to merge them temporally. Say g1.gif contains images 1,2,3 sequenced as so g2.gif contains images 4,5,6 sequenced as so g3.gif contains images 7,8,9 sequenced as so I want a gif as follows g4.gif contains images 1,2,3,4,5,6,7,8,9 sequenced as so I tried `con...
I have 3 .gifs animations and I just want to merge them temporally. Say g1.gif contains images 1,2,3 sequenced as so g2.gif contains images 4,5,6 sequenced as so g3.gif contains images 7,8,9 sequenced as so I want a gif as follows g4.gif contains images 1,2,3,4,5,6,7,8,9 sequenced as so I tried convert *.gif g4.gif but it overlaps them in a weird fashion. All gifs are the same size, arranging, etc Thank you so much
G. Benosa (61 rep)
Feb 17, 2017, 03:13 AM • Last activity: Oct 27, 2022, 09:56 AM
12 votes
4 answers
46216 views
What viewers can play GIF animated images?
On Manjaro running [Fluxbox](http://fluxbox.org/), I don't seem to have an image viewer that can play animated GIF files. I think that [Gwenview](https://userbase.kde.org/Gwenview) can and I have it on my KDE system. But on a Fluxbox system I would like to avoid too many KDE dependencies.
On Manjaro running [Fluxbox](http://fluxbox.org/) , I don't seem to have an image viewer that can play animated GIF files. I think that [Gwenview](https://userbase.kde.org/Gwenview) can and I have it on my KDE system. But on a Fluxbox system I would like to avoid too many KDE dependencies.
user32012
Oct 15, 2015, 02:15 PM • Last activity: May 8, 2022, 07:11 AM
117 votes
10 answers
122602 views
shell command to get pixel size of an image
Is there a shell command that returns the pixel size of an image? I'm trying to produce an animated gif starting from different gifs with different sizes using `convert` (e.g. `convert -delay 50 1.gif 2.gif -loop 0 animated.gif`). The problem is that convert simply overlaps the images using the firs...
Is there a shell command that returns the pixel size of an image? I'm trying to produce an animated gif starting from different gifs with different sizes using convert (e.g. convert -delay 50 1.gif 2.gif -loop 0 animated.gif). The problem is that convert simply overlaps the images using the first image's size as the size of the animated gif, and since they have different sizes the result is a bit of a mess, with bits of the old frames showing under the new ones.
blue (3082 rep)
May 13, 2013, 11:24 AM • Last activity: Jan 28, 2022, 06:51 PM
2 votes
1 answers
306 views
Merge a png on top of a gif with shell
I am trying to merge a png with a gif (put the png on top of the gif) and then have the result as a gif. I played around with `convert`, but cannot quite get it to work the way I need it. I have tried these commands so far: ```none convert layer1.png layer2.gif -append mergedLayers.gif convert-im6.q...
I am trying to merge a png with a gif (put the png on top of the gif) and then have the result as a gif. I played around with convert, but cannot quite get it to work the way I need it. I have tried these commands so far:
convert layer1.png layer2.gif -append mergedLayers.gif
convert-im6.q16: memory allocation failed `layer2.gif' @ error/gif.c/ReadGIFImage/1303.
Anybody got an idea?
milehigh (23 rep)
Jan 18, 2022, 04:43 PM • Last activity: Jan 19, 2022, 09:24 AM
65 votes
7 answers
30410 views
GIF screencasting; the UNIX way
To take a *static screenshot* of a selected part of my screen, I often use [`scrot`][1] with `-s shot.png`. This is great for adding illustrations to StackExchange posts. I even found [this script][2] to automatically upload such a screenshot to *Imgur.com* and put a link in my X clipboard! Let's [t...
To take a *static screenshot* of a selected part of my screen, I often use scrot with -s shot.png. This is great for adding illustrations to StackExchange posts. I even found this script to automatically upload such a screenshot to *Imgur.com* and put a link in my X clipboard! Let's turn this up to *twelve* : **How do I *similarly* create a GIF screencast?** There *are* programs like recordmydesktop, byzanz & co as discussed on Ask Ubuntu that aim to be "user friendly", but in my experience are buggy, inefficient, mostly unscriptable and unsuited for little one-off things like this. I just want to select an area and record a GIF, with a console command I can understand, not some arcane unscriptable GUI monstrosity. How can I do this?
Anko (4666 rep)
Feb 5, 2014, 03:49 PM • Last activity: Mar 13, 2021, 02:41 PM
1 votes
1 answers
356 views
Why this GIF isn't playing smoothly?
in.gif (814KB) ------ [![in.gif][1]][1] in.jpg (1.03MB) ------ [![in.jpg][2]][2] Commands i used to generate a gif - convert -coalesce "in.gif" "0.png" for file in 0*.png do composite -gravity center "$file" in.jpg compose_over"$file" done convert compose_over*.png output.gif output.gif (58.5MB) ---...
in.gif (814KB) ------ in.gif in.jpg (1.03MB) ------ in.jpg Commands i used to generate a gif - convert -coalesce "in.gif" "0.png" for file in 0*.png do composite -gravity center "$file" in.jpg compose_over"$file" done convert compose_over*.png output.gif output.gif (58.5MB) ---------- output.gif The output GIF is not a smooth GIF like the original one. Why? And how can i make it a smooth GIF and how i reduce it's size?
Madhubala (304 rep)
Mar 20, 2020, 02:17 PM • Last activity: Mar 20, 2020, 07:21 PM
3 votes
5 answers
3347 views
Loop MP4 From Converted Animated Gif
How do I convert animated gifs to mp4s that loop? This command successfully converts the gifs to mp4s, but the loop doesn't appear to work: `for i in *.gif; do ffmpeg -f gif -i "$i" -loop 0 "0output$i.mp4"; done` When I play the resulting mp4s in SMPlayer it will only loop if I set SMPlayer to repea...
How do I convert animated gifs to mp4s that loop? This command successfully converts the gifs to mp4s, but the loop doesn't appear to work: for i in *.gif; do ffmpeg -f gif -i "$i" -loop 0 "0output$i.mp4"; done When I play the resulting mp4s in SMPlayer it will only loop if I set SMPlayer to repeat, but then SMplayer has a jitter between repeats so it doesn't repeat smoothly.
whitewings (2527 rep)
May 17, 2016, 05:15 AM • Last activity: Jan 15, 2020, 05:32 PM
2 votes
0 answers
757 views
Create small high-quality GIF/APNG from a bunch of PNGs
I have 50 PNGs (like [those ones here](https://github.com/nschloe/optimesh/raw/gh-pages/examples/pngs.zip)) and I would like to create a GIF (or APNG) animation from it that approximately retains the quality and is small. What I'm doing so far is to rescale and throw `optipng` at them: for file in s...
I have 50 PNGs (like [those ones here](https://github.com/nschloe/optimesh/raw/gh-pages/examples/pngs.zip)) and I would like to create a GIF (or APNG) animation from it that approximately retains the quality and is small. What I'm doing so far is to rescale and throw optipng at them: for file in step*.png; do \ convert -trim -resize 200x200 $$file png8:$$file; \ optipng -quiet $$file; \ done After this, the size of the individual PNGs is about 30KB. (Perhaps more can be tuned here.) Then it's conversion time: $ apngasm out.png step*.png The output file, however, still clocks in at a whopping 1.3 MB. enter image description here Any idea of how to improve this?
Nico Schlömer (678 rep)
Jul 17, 2018, 04:59 PM • Last activity: Jul 17, 2018, 05:07 PM
2 votes
1 answers
10679 views
In XFCE, how do I set an animated GIF as a desktop background?
This should be a simple task, but I can't figure out a way to do this!
This should be a simple task, but I can't figure out a way to do this!
Aaron Franke (1045 rep)
Jun 23, 2017, 06:30 AM • Last activity: May 29, 2018, 07:05 PM
1 votes
1 answers
263 views
How to get convert to not interpolate pixels?
I am using ImageMagick's convert to convert a bunch of .fits files (an image format used in astronomy) to an animated .gif. My astronomical images are pretty low resolution (150 x 300 pixels) but convert seems to make images that are larger than 150 x 300 pixels and then interpolates to figure out "...
I am using ImageMagick's convert to convert a bunch of .fits files (an image format used in astronomy) to an animated .gif. My astronomical images are pretty low resolution (150 x 300 pixels) but convert seems to make images that are larger than 150 x 300 pixels and then interpolates to figure out "appropriate" values for the newly created pixels. I, however, want an accurate presentation of my original .fits images, low resolution and all. What do I need to give to convert so that it doesn't perform any interpolation at all? I don't necessarily care about the resolution/size of the final image (though it should be some size of 150 x 300), I just want the same pixel-to-pixel crispness my original astronomical image has to remain. I know I've done this before, I just can't remember how. Here is a screenshot of the original image: enter image description here And here is the converted image (generated with convert .fits .gif): enter image description here
NeutronStar (1721 rep)
Mar 28, 2018, 06:33 PM • Last activity: Mar 28, 2018, 07:10 PM
0 votes
1 answers
2161 views
How to create a tiled gif (repeating the same small gif image in a tiled background)
I have a gif image with a rather low resolution (500x200 pixels) which I would like to use to tile a wallpaper background (size 1920x1080 etc.) showing the same frame (or a different frame) on all copies. The output should look like using gifview and enlarging the view area. Is there a script to do...
I have a gif image with a rather low resolution (500x200 pixels) which I would like to use to tile a wallpaper background (size 1920x1080 etc.) showing the same frame (or a different frame) on all copies. The output should look like using gifview and enlarging the view area. Is there a script to do this? (I know that I could split the gif in frames, then copy each frame to tile the bigger canvas and finally combine all back to a gif animation, but hopefully there is an automatic way to achieve this.) Thanks for any help.
MHS (101 rep)
Oct 13, 2017, 05:41 PM • Last activity: Oct 13, 2017, 06:46 PM
3 votes
0 answers
330 views
ImageMagick: PNG to GIF: make any not completely transparent pixel solid
I'm trying to create a GIF animation from a set of transparent PNG images in various resolutions. When I `-resize` the edges are aliased. The background is probably quite predictable so I could make it just a solid color, but if possible I want something better: I want all pixels that would be semi-...
I'm trying to create a GIF animation from a set of transparent PNG images in various resolutions. When I -resize the edges are aliased. The background is probably quite predictable so I could make it just a solid color, but if possible I want something better: I want all pixels that would be semi-transparent if the output image would be PNG to be solid with white as the background. Is there some combination of options to ImageMagick that let me do this? My command currently looks like that: for size in 28 42 56 84 112; do echo $size convert -delay 6 -dispose previous {0007..0145}.png -resize ${size}x${size} -coalesce -layers OptimizeFrame scotch_${size}_short.gif done This is how the images look right now: ![](https://i.sstatic.net/VdKNw.gif) ![](https://i.sstatic.net/ybrnG.gif) ![](https://i.sstatic.net/tjhtY.gif) ![](https://i.sstatic.net/4Nto0.gif) ![](https://i.sstatic.net/jSlYZ.gif) See the jagged edges of the smaller versions. Why do I not just make the background solid? It will be used on Twitch as a cheer emote. There the background of the are where it will be displayed is #FFFFFF, but who knows, it might change. So I'd like it to gracefully degrade so it will *then* have visible aliasing until I update the emote. (Note that there is also a dark mode, so I have to do this all twice also for a dark background, but I somehow got that already.)
panzi (131 rep)
May 24, 2017, 01:20 AM • Last activity: May 25, 2017, 12:41 PM
1 votes
2 answers
563 views
`convert`ing *.gif to file.pdf hangs/freezes the system
I've 415 gif files in a directory and trying to make a single pdf of them by using the following command: convert /path/to/*.gif file.pdf But it cause for hanging/freezing of the entire system. In other words it makes the system very slower and I've to Ctrl + c (kill) the process (which also consume...
I've 415 gif files in a directory and trying to make a single pdf of them by using the following command: convert /path/to/*.gif file.pdf But it cause for hanging/freezing of the entire system. In other words it makes the system very slower and I've to Ctrl+c (kill) the process (which also consume some time for stopping). How do I face this issue/problem? Is there any better/alternative mechanism (command/program/work-around) for doing this task? Note: I'm working on my simple Desktop PC (3+3 GHz P4 processor and 1GB og RAM) with Trisquel GNU/Linux 7.0 LTS. The convert program is a member of the [ImageMagick](http://imagemagick.org/) suite of tools.
Pandya (25613 rep)
Nov 21, 2016, 07:08 AM • Last activity: Nov 21, 2016, 02:08 PM
1 votes
0 answers
2071 views
How to open a gif without loop repetition with oeg
I use to open `.gif` file with eog -f myfile.gif The gif animation is however running in loop. What I want is to display the animation once and then quit. How to avoid this? Please also help in case you would have any better utility to open `.gif`,
I use to open .gif file with eog -f myfile.gif The gif animation is however running in loop. What I want is to display the animation once and then quit. How to avoid this? Please also help in case you would have any better utility to open .gif,
user123456 (5258 rep)
Oct 19, 2016, 07:07 PM
1 votes
0 answers
222 views
Identify (and delete) all .gif files with more than 1 frame in all subdirectories
I having the following linux command to identify all .gif files and list its frames in the active directory: identify -format '%n %i\n' -- *.gif Now I want to modify and expand the command to fullfil the following: 1. indentify just the .gif files with MORE than 1 frame 2. look also in all subdirect...
I having the following linux command to identify all .gif files and list its frames in the active directory: identify -format '%n %i\n' -- *.gif Now I want to modify and expand the command to fullfil the following: 1. indentify just the .gif files with MORE than 1 frame 2. look also in all subdirectories (right now the command is just looking at the active directory) 3. a command to: a) list the identified files b) delete the identified files (more important)
w-f (11 rep)
Oct 10, 2016, 09:36 AM • Last activity: Oct 10, 2016, 11:45 PM
6 votes
1 answers
6418 views
Converting asciinema output to gif
Can I convert a `.json` file; generated by a program like [`asciinema`][1]; into an animated `.gif`? [1]: https://github.com/asciinema/asciinema "github | asciinema"
Can I convert a .json file; generated by a program like asciinema ; into an animated .gif?
voices (1332 rep)
Oct 4, 2016, 01:51 PM • Last activity: Oct 5, 2016, 10:31 PM
Showing page 1 of 20 total questions