Method: Blufin::Image.info
- Defined in:
- lib/core/image.rb
.info(path_and_file) ⇒ Object
Uses ImageMagick to return details about an image.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/core/image.rb', line 16 def self.info(path_and_file) check_image_magick_installed raise RuntimeError, "File not found: #{path_and_file}" unless Blufin::Files::file_exists(path_and_file) img = MiniMagick::Image.open(path_and_file) img_container = ImageContainer.new img_container.width = img.dimensions[0].to_i img_container.height = img.dimensions[1].to_i img_container.size = img.size img_container.size_human = img.human_size img_container.type = img.type.downcase img_container.ratio = calc_aspect_ratio(img.dimensions[0].to_i, img.dimensions[1].to_i) img_container end |