Sha256: f575cf5e58a30790175e7c35b852be9b2f238bc9fd7e3931a7703def353dfb8b

Contents?: true

Size: 642 Bytes

Versions: 4

Compression:

Stored size: 642 Bytes

Contents

module Riiif
  # Get 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, format, channels = Riiif::CommandRunner.execute(
        "#{external_command} -format '%h %w %m %[channels]' #{@path}[0]"
      ).split(' ')

      {
        height: Integer(height),
        width: Integer(width),
        format: format,
        channels: channels
      }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
riiif-2.4.0 app/services/riiif/image_magick_info_extractor.rb
riiif-2.3.0 app/services/riiif/image_magick_info_extractor.rb
riiif-2.2.0 app/services/riiif/image_magick_info_extractor.rb
riiif-2.1.0 app/services/riiif/image_magick_info_extractor.rb