fork download
  1. import Image, ImageDraw, random
  2.  
  3. #from http://c...content-available-to-author-only...e.com/recipes/577111-mandelbrot-fractal-using-pil/
  4. # Mandelbrot fractal
  5. # FB - 201003254
  6. # drawing area
  7. xa = -2.0
  8. xb = 1.0
  9. ya = -1.5
  10. yb = 1.5
  11. maxIt = 255 # max iterations allowed
  12. # image size
  13. imgx = 512
  14. imgy = 512
  15. image = Image.new("RGB", (imgx, imgy))
  16.  
  17. x = .3
  18. y = -.1
  19.  
  20. for i in xrange(100000):
  21. c = random.randint(0,2)
  22. if c is 0:
  23. x = x/2.0
  24. y = y/2.0
  25. if c is 1:
  26. x = (x+1)/2.0
  27. y = (y)/2.0
  28. if c is 2:
  29. x = x/2.0
  30. y = (y+1)/2.0
  31. cx = x * imgx
  32. cy = y * imgy
  33. if x >= 0 and y >= 0 and x < imgx and y < imgy and i > 20:
  34. image.putpixel((int(cx), int(cy)), (255,255,255))
  35.  
  36.  
  37.  
  38.  
  39. # ideone output
  40. import StringIO
  41. output = StringIO.StringIO()
  42. image.save(output, 'PNG')
  43. contents = output.getvalue()
  44. output.close()
  45. print contents
Success #stdin #stdout 0.91s 12016KB
stdin
Standard input is empty
stdout
w|6&{g^>Qx|666ϺWT~Ө5>>x|6V=Mx|6V:׽gXx,?tV&CG=CΟMs_?7_?d;6ǒ,Ǫyg,ǺL'Ifg,ǺF_}}ǒ,Ǫw*W&XU=?%XU=c6%XU=zRg,Ǻp?ɦz_9 ǒߚMwc=?{y5SlKZʿzvm3tZ?c 7Kzd#X%X_AK_fjc?cUW4ǒwc?cUϿfjGK_o#X%Xv?c?VȦdm7d2/pKPXL]*f xuƫ}Q|7*ee5gU.[=տxuZ*e.>}@e? ~}d_]zz>e[k:6lTZV_y|W_k~uZ6lTZV >.Skͯ.[=Ww+Skͯ.[=WϺlVO5l\~[z Dmgv}R`יlSX3?yv+^_g_pp-~uKcv_WkA-w[TGůNcWug?DsrRHרթ,ZUU񫋪?DbukvB_Xz>_Xi :?ؾ"33;~u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