Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 4 down vote accepted

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).

share|improve this answer
    
Why not using the -exec action of find? – cYrus Jan 10 '11 at 11:34
    
-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 Jan 10 '11 at 13:48
    
Exactly what I needed, Namaste..Ps: long live the command line :) – Webmaster Jan 10 '11 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .