Sha256: 8927ae425f8bc7c8a3cc769271a3342a2827ec5bbf53d4dd8e2a7c46677ec896
Contents?: true
Size: 731 Bytes
Versions: 1
Compression:
Stored size: 731 Bytes
Contents
require 'RMagick' require 'rvg/rvg' module PlaceholderImage module Generators class RMagick def self.generate(options) # background rvg = ::Magick::RVG.new(options[:width], options[:height]).viewbox(0, 0, options[:width], options[:height]) do |canvas| canvas.background_fill = options[:background_color] end image = rvg.draw # text draw = ::Magick::Draw.new draw.pointsize = options[:width] / options[:text_scale_factor] draw.fill = options[:text_color] draw.gravity = ::Magick::CenterGravity draw.annotate(image, 0, 0, 0, 0, options[:text]) image.format = options[:format] image end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
merchii-placeholder_image-0.1.0 | lib/placeholder_image/generators/rmagick.rb |