Skip to content

Instantly share code, notes, and snippets.

@campanalbero
Last active December 25, 2015 05:29
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 campanalbero/6924815 to your computer and use it in GitHub Desktop.
Save campanalbero/6924815 to your computer and use it in GitHub Desktop.
ImageMagick を Ruby から使う。フォルダ内の png をトリミングして、 tmp フォルダに同名ファイルで保存する。
require 'rubygems'
require 'mini_magick'
Dir.glob('*.png') do |f|
image = MiniMagick::Image.open(f);
image.crop("752x422+229+206")
image.write('tmp/' + f)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment