Sha256: 4af7a0e6d10ae1781e767cadd4c97e0c9ec0dbda2501d010b9a58a6c4ddb16a1
Contents?: true
Size: 762 Bytes
Versions: 7
Compression:
Stored size: 762 Bytes
Contents
require 'fileutils' require 'oily_png' module Gnawrnip class Image # # @parma [String] filepath Screenshot image filepath # def initialize(filepath) @filepath = filepath end def to_html width = canvas.width height = canvas.height src = canvas.to_data_url %Q(<img width="#{width}" height="#{height}" src="#{src}"/>) end # # @return [Fixnum] Width of image # def width canvas.width end # # @return [Fixnum] Height of image # def height canvas.height end def resize(width, height) canvas.resample_bilinear!(width, height) end private def canvas @canvas ||= OilyPNG::Canvas.from_file(@filepath) end end end
Version data entries
7 entries across 7 versions & 1 rubygems