Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib
- from PIL import Image, ImageDraw, ImageFont
- import json
- with open('book.json', 'r') as f:
- distros_dict = json.load(f)
- for distro in distros_dict:
- message=(distro['Book Type'])
- message1=(distro['Author'])
- image_path_input = '/home/anitha/Desktop/coverimages/'
- image_name_input = '14.jpg'
- image = Image.open(image_path_input + image_name_input)
- print (image)
- draw = ImageDraw.Draw(image)
- font = ImageFont.truetype("/home/anitha/Downloads/vijaya.ttf", 65)
- (x, y) = (300, 50)
- color = 'rgb(0, 0, 0)' # black color
- draw.text((x, y), message, fill=color, font=font)
- (x1, y1) = (800, 50)
- color = 'rgb(0, 0, 0)' # black color
- draw.text((x1, y1), message1, fill=color, font=font)
- image.save('greeting_card.jpg')
- print ("__________________________________________________")
Add Comment
Please, Sign In to add comment