Created
May 30, 2015 13:30
-
-
Save Shinichi-Ohki/ef59236dc11166da0b84 to your computer and use it in GitHub Desktop.
一つの画像を縦に半分に切って二つにする
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'RMagick' | |
include Magick | |
fext = File.extname(ARGV[0]) | |
fname = File.basename(ARGV[0],fext) | |
img = Magick::ImageList.new(ARGV[0]) | |
imgsize_x = img.columns | |
imgsize_y = img.rows | |
img_L = img.crop(0,0,imgsize_x/2, imgsize_y) | |
img_L.write(fname+'_1'+fext) | |
img_R = img.crop(imgsize_x/2,0,imgsize_x/2,imgsize_y) | |
img_R.write(fname+'_2'+fext) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment