Guest User

Untitled

a guest
May 29th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. import urllib
  2. from PIL import Image, ImageDraw, ImageFont
  3. import json
  4.  
  5. with open('book.json', 'r') as f:
  6. distros_dict = json.load(f)
  7. for distro in distros_dict:
  8. message=(distro['Book Type'])
  9. message1=(distro['Author'])
  10. image_path_input = '/home/anitha/Desktop/coverimages/'
  11. image_name_input = '14.jpg'
  12. image = Image.open(image_path_input + image_name_input)
  13. print (image)
  14. draw = ImageDraw.Draw(image)
  15. font = ImageFont.truetype("/home/anitha/Downloads/vijaya.ttf", 65)
  16. (x, y) = (300, 50)
  17. color = 'rgb(0, 0, 0)' # black color
  18. draw.text((x, y), message, fill=color, font=font)
  19. (x1, y1) = (800, 50)
  20. color = 'rgb(0, 0, 0)' # black color
  21. draw.text((x1, y1), message1, fill=color, font=font)
  22. image.save('greeting_card.jpg')
  23. print ("__________________________________________________")
Add Comment
Please, Sign In to add comment