I want to create my own images of the Julia set of the complex function $e^z-2$, similar to the one below:

[![enter image description here](https://i.stack.imgur.com/KoyBv.png)](https://i.stack.imgur.com/KoyBv.png)

The simple (Python) program:

```
import cmath
from PIL import Image 

if __name__ == "__main__": 

w, h, zoom = 1600,1000,1

bitmap = Image.new("RGB", (w, h), "white") 

pix = bitmap.load() 

maxIter = 6

for x in range(w): 
    for y in range(h): 
        zx = 1.0*(x - w/2)/200 + 3 
        zy = 1.0*(y - h/2)/200 + 0
        z=complex(zx,zy)
        i = maxIter 
        while  z.real< 50 and i > 1:
            z=cmath.exp(z)-complex(2,0)
            i -= 1
        if i==1:
            pix[x,y] = 255,255,255
        if i>1:
            pix[x,y] = 0,0,0

bitmap.show()

```

produces this image:

[![enter image description here](https://i.stack.imgur.com/Tv2Hf.png)](https://i.stack.imgur.com/Tv2Hf.png)

Essentially, the Julia set of this function is just the set of escaping points. So the idea for my program was to test the first few iterates of the function on each point $z$, and see if any of those iterates is large (in modulus or just the real part). But clearly it's not good enough. How can I improve it to get the top image? Or, can you give a new Python code to produce the top image?