0

I need a bash script which will run through a folder of 100s of jpegs and create montages of every 30 images and output the montages with distinct file names.

The G'Mic command to create a montage from a folder of images*:

gmic *.jpg -gimp_montage 4,\""V(H(0,1),H(2,V(3,4)))"\",1,1.0,0,5,0,0,0,255,0,0,0,0 -o output.jpg

*NOTE: Another zero may have to be added to the following part of the command to get it to work, e.g.:

255,0,0,0,0,0 -o output.jpg

  • Which part of this is giving you trouble? Are you just asking us to do your work for you and write the script from scratch? Please edit your question and show us what you have so far, we're not a free script writing service. – terdon Jun 23 '15 at 18:16
  • @terdon Obviously I don't know how to write a script for this, otherwise I wouldn't be asking. It's not laziness at all. It's a bounty question. I'm giving up 50 points of my reputation. I'm awarding the bounty to Rodin in 6 hours. – user8547 Jun 23 '15 at 20:59
  • 1
    Nevertheless, this is not what the site is for, please don't do it. We're not a free script writing service, we're here to answer specific questions. You need to read up a little on scripting, get a general idea of how to do this and at least try. It doesn't need to be a good attempt, just an attempt. Just something to show us you're not just too lazy to do your work and asking others to do it for you. Also, pro tip: it's often a question of phrasing, don't ask for a script, ask how you can achieve something, that often gets better results. – terdon Jun 23 '15 at 21:16
1
+50

Not sure if this is a researched question, but anyway, a small shell script can do something like:

c=0
for i in *.jpg; do
  c=$(($c+1))
  f="$f $i"
  test "$(expr $c % 30)" != 0 && continue
  gmic $f ... -o output-$c.jpg
  f=""
done
test -z "$f" || gmic $f ...  -o output-$(($c+1)).jpg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.