Class: ImageMosaic::Image::Parent

Inherits:
Object
  • Object
show all
Defined in:
lib/image_mosaic/image/parent.rb

Overview

Takes an array of images and metrics and then returns a single image of composited images.

Instance Method Summary collapse

Constructor Details

#initialize(items, colour:, width:) ⇒ Parent

Returns a new instance of Parent.



5
6
7
8
9
# File 'lib/image_mosaic/image/parent.rb', line 5

def initialize(items, colour:, width:)
  @items = items
  @colour = colour
  @width = width
end

Instance Method Details

#createObject



11
12
13
14
15
# File 'lib/image_mosaic/image/parent.rb', line 11

def create
  image.run_command(:convert, '-size', dimensions, "xc:#{@colour}", image.path)
  @items.each { |item| @image = add_image(item) }
  Mosaic.new(image)
end