Skip to content

Instantly share code, notes, and snippets.

@tatey
Created April 7, 2015 01:46
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/697f028679b26deaa804 to your computer and use it in GitHub Desktop.
Save tatey/697f028679b26deaa804 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)
`convert #{template_image.to_s} #{source_image.to_s} -gravity center -compose CopyOpacity -composite -channel A -negate #{dest_image.to_s}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment