Created
March 25, 2012 13:47
-
-
Save luisparravicini/2194335 to your computer and use it in GitHub Desktop.
Compose several images using ImageMagick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
include FileUtils | |
dir = ARGV.shift | |
method = ARGV.shift | |
if dir.nil? || method.nil? | |
puts "usage #{$0} <image-dir> <method>" | |
exit 1 | |
end | |
out_path = "method_#{method}.jpg" | |
tmp_path = 'tmp.jpg' | |
files = Dir.glob(File.join(dir, '*.jpg')) | |
cp(files.pop, out_path) | |
offset = 1.to_f | |
files.each do |path| | |
print "%s\t%2.0f%%\r" % [File.basename(path), 100*offset/files.size] | |
offset += 1 | |
out = `composite "#{path}" "#{out_path}" -compose #{method} "#{tmp_path}" 2>&1` | |
raise "error composing image: #{out}" unless $?.success? | |
mv(tmp_path, out_path) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've got the most success for a test night time-lapse with "lightenIntensity" as method, here what I came up with (this was a test by dusk I still had laying around):