Page 1 of 1

Montage - Exclude Videos ?

Posted: 2018-03-03T22:20:30-07:00
by sum_duud
Good day, I am using Montage to create a Contact_Sheet.jpg in several direcrories, one contact sheet per directory. However some of the directories have small video files (.mp4 or .mpg) along with the JPG, TIFF, PNG and RAW files, is there a way to specifically exclude files such --exclude *,mpg ? or similar.

ImageMagick 7.0.7-22 Q16 x86_64 2018-01-13 for Mac OSX

Thanks in advance

Re: Montage - Exclude Videos ?

Posted: 2018-03-04T13:52:15-07:00
by fmw42
You can just list the formats you want. For example:

Code: Select all

magick montage *.jpg *.tif -tile x1 result.png

Re: Montage - Exclude Videos ?

Posted: 2018-03-04T14:07:49-07:00
by fmw42
This will exclude jpg from the directory

Code: Select all

magick montage $(ls | grep -v "\.jpg$") -tile x1 tmp.png
where i have use

ls | grep -v "\.jpg$"

to make a list of all files in the directory excluding .jpg

Search google and you will find other methods.

Re: Montage - Exclude Videos ?

Posted: 2018-03-04T14:32:42-07:00
by sum_duud
Excellent, thanks for the help guys this is great.
The excluding specific formats with Grep seems like a great way to go.
$(ls | grep -v "\.mpg$")

Re: Montage - Exclude Videos ?

Posted: 2018-03-04T16:06:19-07:00
by GeeMack
sum_duud wrote: 2018-03-04T14:32:42-07:00Excellent, thanks for the help guys this is great.
The excluding specific formats with Grep seems like a great way to go.
$(ls | grep -v "\.mpg$")
Also, most versions of "ls" will accept an "--ignore" option. To omit the MPGs from the listing, try something like this...

Code: Select all

ls --ignore "*.mpg"

Re: Montage - Exclude Videos ?

Posted: 2018-03-04T16:08:20-07:00
by fmw42
That does not work on my Mac. I tried it.

Re: Montage - Exclude Videos ?

Posted: 2018-03-04T16:43:51-07:00
by GeeMack
fmw42 wrote: 2018-03-04T16:08:20-07:00That does not work on my Mac. I tried it.
At least on my installation the "ls" that comes with Windows 10 bash accepts that "--ignore" option. Maybe it's not as common as I thought.

I have an "ls" that comes as part of a GNU32 package and runs from the Windows command line. It takes an upper-case "-I" option. This ignores the "*.mpg" files...

Code: Select all

ls -I"*.mpg"
Given those variations, piping the output of "ls" through "grep" may be a better, more universal solution.

Re: Montage - Exclude Videos ?

Posted: 2018-03-04T16:56:26-07:00
by fmw42
That option is not available on my Mac either. I checked that also earlier as per some Google searches. I think it because Mac is not using GNU unix. I have had trouble before with the Mac Unix not being as flexible as GNU.

P.S. Those were both good suggestions and I found them also by doing a Google search. But they just don't work on the Mac. So I generally try to use solutions that work on my Mac, since they generally also work in other Linux systems.

Re: Montage - Exclude Videos ?

Posted: 2018-03-04T17:22:14-07:00
by snibgo
"ls --include '*.mpg'" and "ls -I '*.mpg'" work fine on the ls that comes with Cygwin, on my Windows 8.1. It works both in bash, and from the Windows CMD prompt.