Guest User

Untitled

a guest
Feb 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. bg =Magick::ImageList.new("calendar.jpg")
  2. cal_img=ImageList.new("cal_images/" + quote[:image_name])
  3. cal_img=cal_img.sample(158, 223)
  4. text=Magick::Draw.new
  5. text.pointsize =20
  6. text.gravity = Magick::NorthWestGravity
  7. bg.annotate(text,0,0,20,66,quote[:salutations] )
  8. line_y=100
  9. for line in lines
  10. text.annotate(bg,0,0,20,line_y,line)
  11. line_y+=20
  12. end
  13. bg.composite(cal_img, Magick::NorthWestGravity,40,100, Magick::OverCompositeOp)
  14. bg.annotate(text,0,0,20,300,quote[:first_name] + " " + quote[:last_name])
  15. bg.annotate(text,0,0,20,330,"Grade " + quote[:grade])
  16. bg.annotate(text,0,0,146,429,@organization.name)
  17. bg.annotate(text,0,0,146,449,@project.motto)
  18. bg.annotate(text,0,0,423,30,Time.now.strftime("%A"))
  19. bg.annotate(text,0,0,423,50,Time.now.strftime("%b") + " " + Time.now.strftime("%d") )
  20. bg=bg.flatten_images()
  21. @image_name=Digest::SHA1.hexdigest(quote[:first_name]+quote[:quote])
  22. bg.write('quote_images/' +@image_name +'.jpg')
Add Comment
Please, Sign In to add comment