Class: Gnawrnip::Image
- Inherits:
-
Object
- Object
- Gnawrnip::Image
- Defined in:
- lib/gnawrnip/image.rb
Instance Method Summary collapse
-
#height ⇒ Fixnum
Height of image.
-
#initialize(filepath) ⇒ Image
constructor
A new instance of Image.
- #resize(width, height) ⇒ Object
- #to_html ⇒ Object
-
#width ⇒ Fixnum
Width of image.
Constructor Details
#initialize(filepath) ⇒ Image
Returns a new instance of Image.
9 10 11 |
# File 'lib/gnawrnip/image.rb', line 9 def initialize(filepath) @filepath = filepath end |
Instance Method Details
#height ⇒ Fixnum
Returns Height of image.
31 32 33 |
# File 'lib/gnawrnip/image.rb', line 31 def height canvas.height end |
#resize(width, height) ⇒ Object
35 36 37 |
# File 'lib/gnawrnip/image.rb', line 35 def resize(width, height) canvas.resample_bilinear!(width, height) end |
#to_html ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/gnawrnip/image.rb', line 13 def to_html width = canvas.width height = canvas.height src = canvas.to_data_url %Q(<img width="#{width}" height="#{height}" src="#{src}"/>) end |
#width ⇒ Fixnum
Returns Width of image.
24 25 26 |
# File 'lib/gnawrnip/image.rb', line 24 def width canvas.width end |