-
-
Save ToQoz/1273196 to your computer and use it in GitHub Desktop.
jpegからイケメン画像たくさん生成するやつ(Macじゃなくても動く気がする
This file contains 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 'base64' | |
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,'r') do |f| | |
File.open("#{filename}#{i}#{j}.#{ext}",'w') do |img| | |
img.write Base64.decode64(Base64.encode64(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