Class: DragonflyLibvips::Analysers::ImageProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly_libvips/analysers/image_properties.rb

Instance Method Summary collapse

Instance Method Details

#call(content) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dragonfly_libvips/analysers/image_properties.rb', line 4

def call(content)
  require 'vips'
  img = ::Vips::Image.new_from_file(content.path, access: :sequential)

  {
    'format' => content.ext,
    'width' => img.width,
    'height' => img.height,
    'xres' => img.xres,
    'yres' => img.yres
  }
end