1
# contributed by Stefan Schenk
3
from cStringIO import StringIO
7
xiterations = yiterations = 250
13
p = color.palette.RedBlue
15
def rgbcolortostring(c):
16
return "".join([chr(int(255*c.color[name])) for name in "rgb"])
21
for y in range(yiterations):
22
for x in range(xiterations):
23
z = complex(1.0*(Max_Re-Min_Re)*x/xiterations + Min_Re,
24
1.0*(Max_Im-Min_Im)*y/yiterations + Min_Im)
29
# append color(RGB) of the current pixel to the end of data
30
data.write(rgbcolortostring(p.getcolor(1.0/sqrt(k+1))))
35
# generate image from data
36
julia = bitmap.image(xiterations, yiterations, "RGB", data.getvalue())
37
juliabitmap = bitmap.bitmap(0, 0, julia, height=10)
41
c.writeEPSfile("julia")
42
c.writePDFfile("julia")