/[cvs]/fract/julia.cgi
ViewVC logotype

Contents of /fract/julia.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sat Feb 24 15:57:15 2001 UTC (23 years, 8 months ago) by teddy
Branch point for: masse, MAIN
Initial revision

1 #!/usr/bin/python
2
3 import cgi, Image, sys
4 from string import atoi
5
6 side= 400
7 maxiter= 200
8
9 form= cgi.FieldStorage()
10 julia= Image.new("L",(side,side))
11
12 inx= atoi(form['image.x'].value)
13 iny= atoi(form['image.y'].value)
14 side2= side-1
15
16 c= (inx-285)/142.5
17 c= c+(iny-285)*(0+1j)/142.5
18
19 for x in range(0,side):
20 for y in range(0,side/2+1):
21 z= (x-(side/2.0))/(side/3.0)
22 z= z+(y-(side/2.0))*(0+1j)/(side/3.0)
23 i= 0
24 while i<maxiter and abs(z)<2:
25 z= z**2+c
26 i= i+1
27 color= ((i**0.5)*40%256)
28 if i<maxiter:
29 julia.putpixel((x,y),color)
30 julia.putpixel((side2-x,side2-y),color)
31
32 print "Content-type: image/png"
33 print
34
35 julia.save(sys.stdout, "PNG")
36
37 # Local Variables:
38 # version-control: t
39 # mode: python
40 # backup-by-copying: nil
41 # backup-by-copying-when-mismatch: nil
42 # kept-old-versions: 50
43 # kept-new-versions: 50
44 # End:

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26