Skip to content

Instantly share code, notes, and snippets.

@kkosuge
Created October 8, 2011 18:05
Show Gist options
  • Save kkosuge/1272633 to your computer and use it in GitHub Desktop.
Save kkosuge/1272633 to your computer and use it in GitHub Desktop.
jpegからイケメン画像たくさん生成するやつ(Macじゃなくても動く気がする
path = ARGV.shift
if File.exists?(path) && path.match(/^(.+)\.(.+)$/)
files = []
filename = $1
ext = $2
10.times do |i|
10.times do |j|
File.open(path,'rb') do |f|
File.open("#{filename}#{i}#{j}.#{ext}",'w') do |img|
img.write f.read.gsub!(i.to_s,j.to_s)
end
files << output = "#{filename}#{i}#{j}.#{ext}"
end
end
end
# `open -a preview #{files.join(" ")}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment