Skip to content

Instantly share code, notes, and snippets.

@rohinomiya
Created September 29, 2011 16:20
Show Gist options
  • Save rohinomiya/1251146 to your computer and use it in GitHub Desktop.
Save rohinomiya/1251146 to your computer and use it in GitHub Desktop.
# 画像を縦横比を維持したまま縦1280ピクセルに縮小する
require 'rubygems'
require 'pikl'
IMAGE_HEIGHT = 1280
Dir.glob('*.jpg').each {|f|
img = Pikl::Image.open(f)
if img.height > IMAGE_HEIGHT
img.resize(:auto, IMAGE_HEIGHT).save(f)
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment