-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python2.6 | ||
#_*_coding:utf8_*_ | ||
|
||
#importan las librerias PIL | ||
|
||
from PIL import Image, ImageDraw | ||
from PIL import ImageFont | ||
|
||
|
||
# Dibujar Imagen | ||
|
||
img=Image.new("RGB",(350,350),(460,210,250)) | ||
|
||
dibujo=ImageDraw.Draw(img) | ||
dibujo.line((100,100,200,200)) | ||
|
||
|
||
#Dibujar una linea | ||
dibujo.line([10,10,10,35,90,100,150,180]) | ||
|
||
|
||
#Dibujar un poligono | ||
dibujo.polygon([100,100,130,165,150,200,100,280], fill=(255,0,0), outline=(255,0,0)) | ||
|
||
|
||
#Agregar texto y Cambiar letra (para cambiar la letra se va a esta carpeta: /usr/share/fonts/liberation/) | ||
|
||
letra=ImageFont.truetype("/usr/share/fonts/liberation/LiberationSans-Italic.ttf",44) | ||
dibujo.text((50,30),"Hello world!",font=letra) | ||
|
||
|
||
|
||
#Dibujar imagen | ||
img.show() |