Page 1 of 1

Zero padded image names

Posted: 2009-04-10T10:19:57-07:00
by daviddoria
If I have images 1.jpg, 2.jpg ... 5.jpg, I can do this

Code: Select all

#convert [1-5].jpg +append append.jpg
But if I have images 001.jpg, 002.jpg ... 005.jpg, the above does not work, and the following also does not work.

Code: Select all

convert [001-005].jpg +append append.jpg
Is there a way to do that? (I have more than 5 images, so 00[1-5].jpg is not the answer! haha)

Thanks,

Dave

Re: Zero padded image names

Posted: 2009-04-10T22:46:31-07:00
by anthony
From raw notes in IM Examples, File Handling, Read Modifiers
http://www.imagemagick.org/Usage/files/#read

Code: Select all

convert 'image_%03d.png[5-7]' ...
The %03d specifys insert the numbers as 3 zero padded digits (See man page for the "printf()" function.

NOTE this is NOT a command line shell construct but a IM construct, so you need to quote the
input filename.


The [5-7].jpg construct is a shell expandsion, and not done by IM itself. The shell replaces it with 5.jpg 6.jpg 7.jpg if those files exists.

Re: Zero padded image names

Posted: 2009-04-11T04:37:09-07:00
by daviddoria
Great, thanks.