document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. require "rmagick"
  2. include Magick
  3.  
  4. # Load Recipe Image From File
  5. recipie_image = Image.read("../recipie.jpg").first
  6.  
  7. # Load the Chef Image
  8. chef_image = Image.read("../chef.png").first
  9.  
  10. # Get size of the recipe image
  11. width, height = recipie_image.columns, recipie_image.rows
  12.  
  13. # Generate the Gradient Image Based On An ImageMagick "canvas creation string"
  14. gradient_image = Image.read("gradient:rgba(0,0,0,0.7)-rgba(0,0,0,0.0)") do
  15.     self.size = "#{width}x#{height}"
  16. end
  17.  
  18. # Now, to overlay the gradient_image on top of the recipie_image
  19. recipie_image = recipie_image.composite( gradient_image.first, 0, 0, OverCompositeOp)
  20.  
  21. # Scale down the chef image so that it looks good
  22. chef_image = chef_image.scale(0.5)
  23.  
  24. # Finally, to overlay the chef image on top of that
  25. recipie_image = recipie_image.composite( chef_image, 30, 30, OverCompositeOp)
  26.  
  27. #Write the final image to the file:
  28. recipie_image.write(\'output.jpg\')
');