-
-
Save hitode909/8dc2a722b24b0cfefd14a47428c33135 to your computer and use it in GitHub Desktop.
書き初め
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
INPUT_FILE, OUTPUT_FILE = *ARGV | |
OUTPUT_SIZE = 500 | |
HALF_SIZE = OUTPUT_SIZE / 2 | |
files = [] | |
direction = 0 | |
while direction < 45 | |
key_file = "direction-#{direction}.gif" | |
files.push key_file | |
system "convert #{INPUT_FILE} -set option:distort:viewport #{OUTPUT_SIZE}x#{OUTPUT_SIZE}-#{HALF_SIZE}-#{HALF_SIZE} -virtual-pixel tile -distort Arc '45 #{direction} 50' +repage #{key_file}" | |
direction += 9 | |
end | |
system "convert -coalesce -background white -alpha remove Background -background white -loop 0 -delay 3 #{files.join(' ')} #{OUTPUT_FILE}" | |
files.each{|file| | |
File.unlink(file) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment