Page 1 of 1

Convert set of images streamed to STDIN into animated GIF

Posted: 2013-11-15T23:28:55-07:00
by jdevelop
Hello!

I have third-party app which writes set of PNG images to STDOUT. Is there any way to get animated GIF from these images? I tried so far

Code: Select all

app | convert png:- output.gif
but that captures only first image and skips all subsequent frames.

Please advice.

Re: Convert set of images streamed to STDIN into animated GIF

Posted: 2018-02-21T05:53:30-07:00
by zarel
I know this thread is very old but we encountered the very same problem and I wanted to avoid the "wisdom of the ancients" effect.

It looks like that many images can be passed to convert via STDIO only when they're in PPM format. If you don't want to change your app to output PPM you can pipe your app output to ffmpeg and then to convert like this:

Code: Select all

app | ffmpeg -i - -f image2pipe -vcodec ppm - | convert - output.gif
We tested it with an app that streams JPGs and PNGs

Re: Convert set of images streamed to STDIN into animated GIF

Posted: 2018-02-21T06:52:23-07:00
by snibgo
Extra bytes at the end of a PNG stream are ignored by IM, hence only the first PNG is processed. The same is true of JPG. Some formats (eg PPM, GIF, TIFF and MIFF) can contain multiple images, and each will be processed.