Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # blendtransparency.py >>> also img.show() workaround
- import webbrowser, tempfile, re
- tf=tempfile.mktemp(".jpg", "py_x")
- tf=re.sub(r'(appdata).+?(temp)','pictures',tf)
- print tf
- from PIL import Image, ImageDraw
- img=Image.new('RGB', (400, 400))
- cv=ImageDraw.Draw(img, 'RGBA')
- cv.rectangle([(0, 0), (400, 400)], (255, 255, 255, 255)) # white
- cv.rectangle([(100, 100), (400, 400)], (255, 255, 0, 255)) # yellow
- cv.rectangle([(0, 0), (300, 300)], (0, 0, 255, 125)) # blue
- img.save(tf)
- # img.show() ??? did not work on my computer so...
- webbrowser.open(tf) # opened via Windows (10) Viewer instead of Browser
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement