Couldn’t Find it Anywhere

What couldn’t I find?

I was looking for a one-liner means by which to duplicate images.  In other words, I was too lazy to write a script.  The answer was surprisingly difficult to find on the internet.  Methinks it is too easy, or so easy that it’s obvious?  Anyway, this is for those who need to do this task (image duplicates are needed to build frame directories of 30 frames per jpeg image, to facilitate building an animated gif or a video frame-set from a series of stills).

The secret sauce is to use imagemagick’s convert command.  Using it thusly:

  • convert stillframe1.jpg -duplicate 30,-1 stillframes%05d.jpg

… makes for a very simple one-line command line solution.

The -duplicate syntax is crucial, and its arguments are for count (30 in my case) and the -1 value, which means that the last image in any sequence should be used.  In my one-liner, there is only one image but the argument is still needed.

Often I want a still image to be displayed within a video for a few seconds or ten seconds, as a matter of the choreography.  For ten seconds, the count value would be 300.  The one-liner syntax using the convert utility is great for simple cases, but with a little scripting, a whole directory full of individual, differing images could be embedded in the video as well.

 

Advertisements