Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Thu Jul 07 22:36:01 2012
- @author: Marshall
- """
- import Image
- from PIL import ImageFont
- from PIL import ImageDraw
- font = ImageFont.truetype("C:\\Windows\\Fonts\\raleway_thin.otf", 60, encoding='unic')
- editFile = "tranp.png"
- imageFile = Image.open(editFile)
- handFile = Image.open("hand.png")
- text = "MARSHALL"
- number = 19
- pixel = imageFile.load()
- r, g, b, alpha = imageFile.split()
- r2,g2,b2,a2 = handFile.split()
- newImage = Image.new(imageFile.mode, (550,550), (70,70,70))
- newImage.paste(imageFile,(90,0), mask=alpha)
- newImage = newImage.rotate(30)
- pixel = newImage.load()
- for x in range(550):
- for y in range(550):
- if pixel[x,y] == (0,0,0,0):
- pixel[x,y] = (70,70,70,0)
- newImage.paste(handFile,(0,155), a2)
- draw = ImageDraw.Draw(newImage)
- x,y = draw.textsize(text, font=font)
- numX, numY = draw.textsize(str(number), font=font)
- draw.text((550-x-numX-20, 550-y-20), text, (180,180,180), font=font)
- draw.text((550-numX-20, 550-y-20), str(number), (132,143,100), font =font)
- newImage = newImage.convert('L')
- #newImage.show()
- newImage.save("result.jpg")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement