Sha256: f4a3e9acd08574335f967603777aee3274c1f3edd6bc60a494fe4f6715ff42b7

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

module Dragonfly
  module Analysis
    class ImageMagickAnalyser

      include ImageMagickUtils
      include Configurable

      def width(temp_object)
        identify(temp_object)[:width]
      end

      def height(temp_object)
        identify(temp_object)[:height]
      end

      def aspect_ratio(temp_object)
        attrs = identify(temp_object)
        attrs[:width].to_f / attrs[:height]
      end

      def portrait?(temp_object)
        attrs = identify(temp_object)
        attrs[:width] <= attrs[:height]
      end

      def landscape?(temp_object)
        attrs = identify(temp_object)
        attrs[:width] >= attrs[:height]
      end

      def depth(temp_object)
        identify(temp_object)[:depth]
      end

      def number_of_colours(temp_object)
        details = raw_identify(temp_object, '-verbose -unique')
        details[/Colors: (\d+)/, 1].to_i
      end
      alias number_of_colors number_of_colours

      def format(temp_object)
        identify(temp_object)[:format]
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
dragonfly-0.8.6 lib/dragonfly/analysis/image_magick_analyser.rb
dragonfly-0.8.5 lib/dragonfly/analysis/image_magick_analyser.rb
dragonfly-0.8.4 lib/dragonfly/analysis/image_magick_analyser.rb
fog-dragonfly-0.8.2 lib/dragonfly/analysis/image_magick_analyser.rb
dragonfly-0.8.2 lib/dragonfly/analysis/image_magick_analyser.rb
fog-dragonfly-0.8.1 lib/dragonfly/analysis/image_magick_analyser.rb
dragonfly-0.8.1 lib/dragonfly/analysis/image_magick_analyser.rb
dragonfly-0.8.0 lib/dragonfly/analysis/image_magick_analyser.rb