Automake thumbnail

2

1

What I need to do is a program that given (as a command line argument) a directory with more directoreies inside, and 4 Pics inside of each dir, the program makes a thumbnail of the 4 files and glues them together (2 rows, 2 columns) and renames that image to the name of the directory.

I think it could be done with a combination of a program and shell scripting (I'm experienced in M$, but new to linux).

Some real examples would be great.

Thanx in advance

Webmaster

Posted 2011-01-10T10:46:57.913

Reputation: 55

Answers

4

Look for ImageMagick. This example should get you going.

Use find and xargs to run it in several directories:

find path -type d -print0 | xargs -0 -i montage ... -size 512x512 '{}/*_orig.*[120x90]' ...

xargs will replace {} with each path that find finds. Replace path with the root directory in which you want the search to begin.

-type d will just return directories.

-print0 makes sure that spaces and other special characters are handled correctly. The option -0 to xargs is the opposite; otherwise xargs would split the the input at every whitespace (tabs, blanks, newlines).

Aaron Digulla

Posted 2011-01-10T10:46:57.913

Reputation: 6 035

Why not using the -exec action of find? – cYrus – 2011-01-10T11:34:35.433

-exec works in this case, too. I'm not sure anymore why I prefer xargs - maybe because the same general pattern allows me to run the same command with a single and several arguments. – Aaron Digulla – 2011-01-10T13:48:19.063

Exactly what I needed, Namaste..Ps: long live the command line :) – Webmaster – 2011-01-10T19:23:39.800