Skip to content

Instantly share code, notes, and snippets.

@tatey
Created April 7, 2015 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatey/aa2158e4d730ec015edf to your computer and use it in GitHub Desktop.
Save tatey/aa2158e4d730ec015edf to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'pry'
require 'pathname'
if ARGV.count != 3
puts "usage: #{__FILE__} <TEMPLATE_IMAGE> <SOURCE_DIR> <DEST_DIR>"
exit(1)
end
template_image = Pathname.new(File.expand_path(ARGV[0]))
source = Pathname.new(File.expand_path(ARGV[1]))
dest = Pathname.new(File.expand_path(ARGV[2]))
source.each_child do |source_image|
dest_image = dest.join(source_image.basename)
`composite -compose Dst_Out -gravity center #{source_image.to_s} #{template_image.to_s} -alpha Set #{dest_image.to_s}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment