repo.or.cz
/
PyX.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
raise proper exception
[PyX.git]
/
examples
/
bitmap
/
pil.py
blob
a8c1edbef744e43798e91172a5319422d10fddde
1
from
pyx
import
*
2
3
# support Image module either from PIL or pillow
4
try
:
5
from
PIL
import
Image
6
except
ImportError
:
7
import
Image
8
9
im
=
Image
.
new
(
"RGB"
, (
3
,
1
))
10
im
.
putpixel
((
0
,
0
), (
255
,
0
,
0
))
11
im
.
putpixel
((
1
,
0
), (
0
,
255
,
0
))
12
im
.
putpixel
((
2
,
0
), (
0
,
0
,
255
))
13
14
c
=
canvas
.
canvas
()
15
c
.
insert
(
bitmap
.
bitmap
(
0
,
0
,
im
,
height
=
0.8
))
16
c
.
writeEPSfile
(
"pil"
)
17
c
.
writePDFfile
(
"pil"
)