Page 1 of 1

montage: label images with part of filename

Posted: 2015-08-14T06:33:49-07:00
by stas_sl
I would like to montage multiple files with names like these:

Code: Select all

1235_9123a46d52ecb2de.png
123_6a51ef8968c64b94.png
1269_a7059318d47dbc01.png
12_45fb8c628863d77a.png
1347_04355d15f39e1e06.png
1349_bcbad21a686712d1.png
1368_229b9d3f692fdd61.png
1369_f69c36e04ba37bcb.png
137_ec3571cde47f7b8a.png
...
I want to label each image with only part of filename before underscore _

If I use the following command

Code: Select all

montage -label %t * show:
then whole filename is displayed that is quite long. Is it possible to extract substring from filenames somehow?

Re: montage: label images with part of filename

Posted: 2015-08-14T07:02:29-07:00
by snibgo
I don't think you can do this directly. You could write a script to first assign labels, then use those labels in a single montage. The script would execute multiple commands like:

Code: Select all

convert 1235_9123a46d52ecb2de.png -set label 1235 1235_9123a46d52ecb2de.png
Then:

Code: Select all

montage -label %l * show:

Re: montage: label images with part of filename

Posted: 2015-08-14T07:37:45-07:00
by stas_sl
Thanks, snibgo, good idea!