language: Python (python 2.7.3)
date: 323 days 6 hours ago
link:
visibility: private
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Image, ImageDraw, ImageFont
 
dimensions = (400, 200)
img = Image.new("RGB", dimensions)
 
# text
font = ImageFont.truetype("/usr/local/share/fonts/UbuntuMono-B.ttf", 50)
font2 = ImageFont.truetype("/usr/local/share/fonts/UbuntuMono-B.ttf", 25)
draw=ImageDraw.Draw(img)
draw.text((20, 20), 'Hacker News : ', fill=(255,255,255), font=font)
draw.text((30, 100), 'You can paint on Ideone', fill=(200,200,200), font=font2)
 
# ideone output
import StringIO
output = StringIO.StringIO()
img.save(output, 'PNG')
contents = output.getvalue()
output.close()
print contents
 
  • upload with new input
  • result: Success     time: 0.17s    memory: 13072 kB     returned value: 0