Generate a TARGA Graphics File of a Julia Set

JULIA_SET, a C program which generates a TGA or TARGA graphics file of a Julia set.

We consider points (X,Y) in a rectangular domain R = [XL,XR]x[YB,YT]. (Here XL=-1.5, XR=+1.5, YB=-1.5, YT=+1.5.

For every (X,Y) in R, let Z be the complex number X+Yi, and let C be some complex constant. (Here, C=-0.8+0.156i.)

For each Z, consider the sequence of points:

        Z(0) = Z,
        Z(k+1) = Z(k)^2 + C

The Julia set is the set of points Z in R with the property that the sequence of points Z(k) remain within R.

To compute a picture of the Julia set, we choose a discrete array of WxH points in R. We carry out up to 200 steps of the iteration for each point Z. If 1000 < |Z| at any time, we assume Z is not in the Julia set.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


JULIA_SET is available in a C version.

Related Data and Programs:


MANDELBROT, a C program which generates an ASCII PPM image of the Mandelbrot fractal set;

MANDELBROT_ASCII, a C program which generates an ASCII image of the Mandelbrot fractal set using just two lines of C.

MANDELBROT_OPENMP, a C program which generates an ASCII Portable Pixel Map (PPM) image of the Mandelbrot fractal set, using OpenMP for parallel execution.

TGA, a data directory which contains TGA or TARGA graphics file;


  1. Heinz-Otto Peitgen, Hartmut Juergens, Dietmar Saupe,
    Chaos and Fractals - New Frontiers in Science,
    Springer, 1992,
    ISBN: 0-387-20229-3,
    LC: Q172.5.C45.P45.

Source Code:

Last revised on 09 July 2019.