Skip to content

Instantly share code, notes, and snippets.

@kkosuge
Forked from rummelonp/ikemen.rb
Created October 8, 2011 16:13
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 kkosuge/1272482 to your computer and use it in GitHub Desktop.
Save kkosuge/1272482 to your computer and use it in GitHub Desktop.
jpegからイケメン画像たくさん生成するやつ(Mac用
path = ARGV.shift
if File.exists?(path) && path.match(/^(.+)\.(jpe?g|jp2)$/)
filename = $1
ext = $2
files = []
10.times do |i|
10.times do |j|
if i != j
files << output = "#{filename}_ikemen_#{i}#{j}.#{ext}"
`cat #{path} | sed s/#{i}/#{j}/g > #{output}` # gsed じゃなくて sed にした
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