Created
June 24, 2011 16:58
-
-
Save ajbonner/1045193 to your computer and use it in GitHub Desktop.
Get the dimensions of an image using ruby's image_size gem
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 'image_size' | |
pwd = File.dirname(__FILE__) | |
Dir.glob(pwd+'/*') do |file| | |
if (File.extname(file) == '.jpg') | |
fh = File.open(file, 'rb') | |
size = ImageSize.new(fh.read) | |
puts "[#{size.w}x#{size.h}] #{file}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment