Select an image group

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
quaid

Select an image group

Post by quaid »

Hi all !

I 've got image01.jpg , image02.jpg , image03.jpg... image50.jpg in the same directory.
I know that

Code: Select all

montage -verbose image01.jpg image02.jpg etc image10.jpg -mode Concatenate -tile x1 image_out.jpg 
works, but how do I can pass only the first 10 images to montage command... like a range [1-10] ?

Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Select an image group

Post by fmw42 »

I have never tried this but see http://www.imagemagick.org/script/comma ... essing.php under Filename References

Consider the filename image-%d.jpg[1-5]. The command

convert image-%d.jpg[1-5]

causes ImageMagick to attempt to read images with these filenames:

image-1.jpg
image-2.jpg
image-3.jpg
image-4.jpg
image-5.jpg


So you should be able to do something similar with your image%2d.jpg[1-10]
quaid

Re: Select an image group

Post by quaid »

the command

Code: Select all

montage 'd:\t\*%d.jpg[1-10]' -mode Concatenate -tile x1 out.jpg
montage: missing an image filename `out.jpg' @ error/montage.c/MontageImageCommand/1723.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Select an image group

Post by fmw42 »

I don't know that you can mix * with %2d I am not that much of an expert. Try it using convert. It may not work in montage as that is older.

convert image%2d.jpg[1-10] result.gif

should make a 10 frame gif if it works. If that works then try image%2d.jpg[1-10] in montage.

Also perhaps without the quotes.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Select an image group

Post by fmw42 »

this does not seems to work and single or double quotes does not help.

convert rose: rose01.jpg
convert rose: rose02.jpg
convert rose: rose03.jpg
convert rose: rose04.jpg
convert rose: rose05.jpg

convert rose%2d.jpg[1-3] rose.gif

but this works

convert rose: rose1.jpg
convert rose: rose2.jpg
convert rose: rose3.jpg
convert rose: rose4.jpg
convert rose: rose5.jpg

convert rose%d.jpg[1-3] rose.gif

identify rose.gif
rose.gif[0] GIF 70x46 70x46+0+0 8-bit PseudoClass 256c 11.3KB 0.000u 0:00.000
rose.gif[1] GIF 70x46 70x46+0+0 8-bit PseudoClass 256c 11.3KB 0.000u 0:00.009
rose.gif[2] GIF 70x46 70x46+0+0 8-bit PseudoClass 256c 11.3KB 0.000u 0:00.009


I am not enough of an expert to know why %d works but %2d does not.


See posts below for corrections
Last edited by fmw42 on 2010-10-09T11:44:40-07:00, edited 1 time in total.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Select an image group

Post by el_supremo »

this does not seems to work and single or double quotes does not help.

convert rose: rose01.jpg
convert rose: rose02.jpg
convert rose: rose03.jpg
convert rose: rose04.jpg
convert rose: rose05.jpg

convert rose%2d.jpg[1-3] rose.gif
%2d will match the sequence 1, 2, 3, ... 9,10,11,12 etc., so there's nothing in the wildcard which will match the zero in the name.
Use:

Code: Select all

convert rose%02d.jpg[1-3] rose.gif
The %02d format matches two-digit numbers with a leading zero for those numbers less than ten, 01, 02 ,03,...,09,10,11, etc.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Select an image group

Post by fmw42 »

Thanks Pete.

I just figured that out and was about the correct my post above.

This works.


convert rose: rose01.jpg
convert rose: rose02.jpg
convert rose: rose03.jpg
convert rose: rose04.jpg


convert rose%02d.jpg[1-3] rose2.gif

identify rose2.gif
rose2.gif[0] GIF 70x46 70x46+0+0 8-bit PseudoClass 256c 11.3KB 0.000u 0:00.009
rose2.gif[1] GIF 70x46 70x46+0+0 8-bit PseudoClass 256c 11.3KB 0.000u 0:00.009
rose2.gif[2] GIF 70x46 70x46+0+0 8-bit PseudoClass 256c 11.3KB 0.000u 0:00.000
quaid

Re: Select an image group

Post by quaid »

Yes ! Now it works:

Code: Select all

montage -verbose image01.jpg image02.jpg .[ ]. image10.jpg -mode Concatenate -tile x1 image_out.jpg 
is equivalent to

Code: Select all

montage -verbose image%2d.jpg[1-10] -mode Concatenate -tile x1 image_out.jpg 
thanks for help !
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Select an image group

Post by fmw42 »

If you have leading zeros, then I believe you need

montage -verbose image%02d.jpg[1-10] -mode Concatenate -tile x1 image_out.jpg
quaid

Re: Select an image group

Post by quaid »

of course... I wrote without "0"... my mistake.

Code: Select all

montage -verbose image01.jpg image02.jpg .[ ]. image10.jpg -mode Concatenate -tile x1 image_out.jpg 
equals to:

Code: Select all

montage -verbose image%02d.jpg[1-10] -mode Concatenate -tile x1 image_out.jpg 
Post Reply