Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bg =Magick::ImageList.new("calendar.jpg")
- cal_img=ImageList.new("cal_images/" + quote[:image_name])
- cal_img=cal_img.sample(158, 223)
- text=Magick::Draw.new
- text.pointsize =20
- text.gravity = Magick::NorthWestGravity
- bg.annotate(text,0,0,20,66,quote[:salutations] )
- line_y=100
- for line in lines
- text.annotate(bg,0,0,20,line_y,line)
- line_y+=20
- end
- bg.composite(cal_img, Magick::NorthWestGravity,40,100, Magick::OverCompositeOp)
- bg.annotate(text,0,0,20,300,quote[:first_name] + " " + quote[:last_name])
- bg.annotate(text,0,0,20,330,"Grade " + quote[:grade])
- bg.annotate(text,0,0,146,429,@organization.name)
- bg.annotate(text,0,0,146,449,@project.motto)
- bg.annotate(text,0,0,423,30,Time.now.strftime("%A"))
- bg.annotate(text,0,0,423,50,Time.now.strftime("%b") + " " + Time.now.strftime("%d") )
- bg=bg.flatten_images()
- @image_name=Digest::SHA1.hexdigest(quote[:first_name]+quote[:quote])
- bg.write('quote_images/' +@image_name +'.jpg')
Add Comment
Please, Sign In to add comment