Class: Riiif::ImageMagickInfoExtractor

Inherits:
Object
  • Object
show all
Defined in:
app/services/riiif/image_magick_info_extractor.rb

Overview

Get height and width information using imagemagick to interrogate the file

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ImageMagickInfoExtractor

Returns a new instance of ImageMagickInfoExtractor.



4
5
6
# File 'app/services/riiif/image_magick_info_extractor.rb', line 4

def initialize(path)
  @path = path
end

Instance Method Details

#extractObject



8
9
10
11
# File 'app/services/riiif/image_magick_info_extractor.rb', line 8

def extract
  height, width = Riiif::CommandRunner.execute("identify -format %hx%w #{@path}").split('x')
  { height: Integer(height), width: Integer(width) }
end