Sha256: 012f3e6223050b59fec946fa9587c20351abb3e2c72fce425bf40bd25c3b5cc6

Contents?: true

Size: 644 Bytes

Versions: 4

Compression:

Stored size: 644 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 & 2 rubygems

Version Path
riiif-2.7.0 app/services/riiif/image_magick_info_extractor.rb
riiif-2.6.0 app/services/riiif/image_magick_info_extractor.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/riiif-2.5.0/app/services/riiif/image_magick_info_extractor.rb
riiif-2.5.0 app/services/riiif/image_magick_info_extractor.rb