Sha256: 3a70bc5b638df5a9ac40cd672f23ca1e8cb20f8f8296e0272459bf932fa0029c
Contents?: true
Size: 890 Bytes
Versions: 1
Compression:
Stored size: 890 Bytes
Contents
module ImageMosaic module Image #Takes an array of images and metrics and then returns a single image of composited images. class Parent def initialize(items, colour:, width:) @items = items @colour = colour @width = width end def create image.run_command(:convert, '-size', dimensions, "xc:#{@colour}", image.path) @items.each { |item| @image = add_image(item) } Mosaic.new(image) end private def dimensions # Parent image is always square for time being. "#{@width}x#{@width}" end def add_image(image) Operations::Compositor.new(@image, image).save end def temp_file @temp_file ||= Tempfile.new(['image_mosaic', '.png']) end def image @image ||= MiniMagick::Image.new(temp_file.path) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
image_mosaic-0.1.3 | lib/image_mosaic/image/parent.rb |