3

I'm using ImageMagick on Ubuntu Linux and I'm attempting to convert sequentially named files into a gif animation. Usually this is an easy operation and only requires that I run something like convert input-*.png output.gif. However, the filenames don't have leading zeros and so the animation order is something like input-0.png input-10.png input-11.png input-12.png etc. See image below:

enter image description here

I'm aware that I should have used the file padding operator (e.g. intput-03%d.jpg) when creating the files. I'm also aware of variety of methods for adding leading zeros to the files. However, at this time renaming the files would not be feasible.

Is there a way to convert those files using the command line on Linux into a gif with the files animated in the correct order?

closed as off-topic by Scott, Hanna, Zach Saucier, Wrzlprmft, plainclothes Dec 2 '15 at 7:56

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This appears to be a tech support question about fixing technology to work as advertised. Please edit the question so that it pertains to using technology to solve a design problem. You may want to check if it hasn't already been asked in Super User. In many cases, contacting the manufacturer is the quickest option." – Hanna, Wrzlprmft, plainclothes
  • "If you're asking for help with implementation, please include what you've tried and why it didn't work with screenshots. Please edit your post with what your desired results are, what resources you referenced and why those didn't work. See this meta post for discussion and see this post on how to ask a good question." – Scott, Zach Saucier
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    It takes less than 3 seconds to add leading zeros to existing file names. I don't understand why that's a hurdle. – Scott Nov 15 '15 at 2:10
  • Like @Scott says: Here is How – joojaa Nov 15 '15 at 6:27
  • If you don't want to rename, you can also create symbolic links in a separate directory having correct names. – sebix Nov 15 '15 at 11:11
  • @Scott that completely depends on how many files there are. – hellocatfood Nov 16 '15 at 0:26
  • 1
    @user5182 uhm.. no it really doesn't. It takes milliseconds to change a file name. So even if there are hundreds or thousands of files, you're looking at a few seconds to let a script run. – Scott Nov 16 '15 at 2:19
2

This answer from the ImageMagick forum solved the problem of combining files into an animation

convert 'image-%d.png[0-20]' output.gif

enter image description here

  • So yeah... you just renamed files as an additional step to the command. Same thing I was eluding to. – Scott Nov 16 '15 at 2:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.