larles wrote:
Last question, if I may: in your solution I have to indicate files I want to load and repeat the "same" command for each of them... is there a way to say "open 6 files and apply the same command to them" ?
You can use wildcards to load the 6 images, if your wildcards uniquely isolate them. Unfortunately you need separate commands for each image so that you append them correctly.
convert '%d.png[0-5]' -trim +repage \
\( -clone 0 -crop 1x3@ -trim +repage -bordercolor white -border 4 +append \) \
\( -clone 1 -crop 1x3@ -trim +repage -bordercolor white -border 4 +append \) \
\( -clone 2 -crop 1x3@ -trim +repage -bordercolor white -border 4 +append \) \
\( -clone 3 -crop 1x3@ -trim +repage -bordercolor white -border 4 +append \) \
\( -clone 4 -crop 1x3@ -trim +repage -bordercolor white -border 4 +append \) \
\( -clone 5 -crop 1x3@ -trim +repage -bordercolor white -border 4 +append \) \
-delete 0-5 -append result.png
Are you trying to deal with an arbitrary number of images with the same command each time?
To do it for any arbitrary number of images, you need to use a subshell process, which is indicated by the ( .... ). You can probably use ls piped to grep to create your list filtered to the images you want. (Thanks to Anthony for teaching me about subshell processing)
list="ss0.png ss1.png ss2.png"
(
for img in $list; do
convert $img -trim +repage -crop 1x3@ -trim +repage -bordercolor white -border 4 +append miff:-
done
) | convert - -append result.png