Sha256: 4a4cfe2f7219c26e76c6b7c3cf7935160f6e13aaee657d4f01bb28e9c0b66baa

Contents?: true

Size: 533 Bytes

Versions: 7

Compression:

Stored size: 533 Bytes

Contents

module Riiif
  # Get height and width information using imagemagick to interrogate the file
  class ImageMagickInfoExtractor
    # perhaps you want to use GraphicsMagick instead, set to "gm identify"
    class_attribute :external_command
    self.external_command = 'identify'

    def initialize(path)
      @path = path
    end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
riiif-1.7.1 app/services/riiif/image_magick_info_extractor.rb
riiif-2.0.0.beta2 app/services/riiif/image_magick_info_extractor.rb
riiif-2.0.0.beta1 app/services/riiif/image_magick_info_extractor.rb
riiif-1.7.0 app/services/riiif/image_magick_info_extractor.rb
riiif-1.6.0 app/services/riiif/image_magick_info_extractor.rb
riiif-1.5.1 app/services/riiif/image_magick_info_extractor.rb
riiif-1.5.0 app/services/riiif/image_magick_info_extractor.rb