#!/usr/bin/env ruby BILDROEHRE=File.dirname(__FILE__) DIR=ARGV[0] TONEMAP=ARGV[1] GAMMA=ARGV[2].to_f i = 0 while line = STDIN.gets fs = line.strip.split s = " -f #{DIR}" args = fs.join (" -f #{DIR}") skip = false fs.each { |f| exposure = `exiftool #{DIR}/#{f} 2>/dev/null | grep 'Shutter Speed Value' | cut -d ':' -f 2 | strips` begin args += " -w #{Rational(exposure).to_f}" rescue STDERR.write "Error, can't get exposure! Skipping #{line}." skip = true break end } next if skip is = i.to_s.rjust(3, "0") s += args cmd = "#{BILDROEHRE}/merge -D -R -g 1.0 -O debevec-#{TONEMAP}-gamma#{GAMMA}-#{is}.jpg -p robertston-#{TONEMAP}-gamma#{GAMMA}-#{is}.jpg #{s}" STDERR.write "#{cmd}\n" `#{cmd}` i += 1 end