class Gnawrnip::Image
Public Class Methods
new(filepath)
click to toggle source
@parma [String] filepath Screenshot
image filepath
# File lib/gnawrnip/image.rb, line 9 def initialize(filepath) @filepath = filepath end
Public Instance Methods
height()
click to toggle source
@return [Fixnum] Height of image
# File lib/gnawrnip/image.rb, line 31 def height canvas.height end
resize(width, height)
click to toggle source
# File lib/gnawrnip/image.rb, line 35 def resize(width, height) canvas.resample_bilinear!(width, height) end
to_html()
click to toggle source
# 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()
click to toggle source
@return [Fixnum] Width of image
# File lib/gnawrnip/image.rb, line 24 def width canvas.width end
Private Instance Methods
canvas()
click to toggle source
# File lib/gnawrnip/image.rb, line 41 def canvas @canvas ||= OilyPNG::Canvas.from_file(@filepath) end