Skip to content

Instantly share code, notes, and snippets.

@joshellington
Created December 11, 2011 21:59
Show Gist options
  • Save joshellington/1463004 to your computer and use it in GitHub Desktop.
Save joshellington/1463004 to your computer and use it in GitHub Desktop.
def self.new_image(images, uid)
final = Magick::Image.new(1000, 600).matte_reset!
last = images.length - 1
images.each_with_index do |image, index|
o = image[1]
n = Magick::Image.read($dir+'/'+o[:src]).first
n.scale!(200, o[:height].to_i)
x = o[:x].to_i
y = o[:y].to_i
final.composite!(n, Magick::NorthWestGravity, x, y, Magick::OverCompositeOp)
final.format = 'jpeg'
pp final
if index == last
final.write($dir+'/'+uid+'/_final.jpg')
end
end
$dir+'/'+uid+'/_final.jpg'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment