Class: Dragonfly::Analysis::RMagickAnalyser

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly/analysis/r_magick_analyser.rb

Instance Method Summary collapse

Instance Method Details

#aspect_ratio(temp_object) ⇒ Object



24
25
26
27
28
# File 'lib/dragonfly/analysis/r_magick_analyser.rb', line 24

def aspect_ratio(temp_object)
  ping_rmagick_image(temp_object) do |image|
    image.columns.to_f / image.rows
  end
end

#depth(temp_object) ⇒ Object



42
43
44
45
46
# File 'lib/dragonfly/analysis/r_magick_analyser.rb', line 42

def depth(temp_object)
  rmagick_image(temp_object) do |image|
    image.depth
  end
end

#format(temp_object) ⇒ Object



55
56
57
58
59
# File 'lib/dragonfly/analysis/r_magick_analyser.rb', line 55

def format(temp_object)
  ping_rmagick_image(temp_object) do |image|
    image.format.downcase.to_sym
  end
end

#height(temp_object) ⇒ Object



18
19
20
21
22
# File 'lib/dragonfly/analysis/r_magick_analyser.rb', line 18

def height(temp_object)
  ping_rmagick_image(temp_object) do |image|
    image.rows
  end
end

#landscape?(temp_object) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
39
40
# File 'lib/dragonfly/analysis/r_magick_analyser.rb', line 36

def landscape?(temp_object)
  ping_rmagick_image(temp_object) do |image|
    image.columns >= image.rows
  end
end

#number_of_colours(temp_object) ⇒ Object



48
49
50
51
52
# File 'lib/dragonfly/analysis/r_magick_analyser.rb', line 48

def number_of_colours(temp_object)
  rmagick_image(temp_object) do |image|
    image.number_colors
  end
end

#portrait?(temp_object) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
34
# File 'lib/dragonfly/analysis/r_magick_analyser.rb', line 30

def portrait?(temp_object)
  ping_rmagick_image(temp_object) do |image|
    image.columns <= image.rows
  end
end

#width(temp_object) ⇒ Object



12
13
14
15
16
# File 'lib/dragonfly/analysis/r_magick_analyser.rb', line 12

def width(temp_object)
  ping_rmagick_image(temp_object) do |image|
    image.columns
  end
end