Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Gobrot is a mandelbrot image renderer written in Go. The renderer takes advantage of Go's concurrent and parallel programming feature known as goroutine.

Mandelbrot images are generated by applying a mathematical function to each complex number projected in the complex plane and determining for each whether they are bounded or escapes towards infinity. The mandelbrot set is defined by the following formula: z_{n+1} = z_n^2 + c.

Treating the real and imaginary parts of each number as image coordinates, pixels are colored according to how rapidly the sequence diverges, if at all.


$ go get github.com/esimov/gobrot
$ go install

Before to run the code you need to include the project into the GOPATH environment variable.

$ export GOPATH="$HOME/go"
$ export PATH="$PATH:$GOPATH/bin"

See the documentation: https://golang.org/doc/code.html#GOPATH


$ gobrot


$ gobrot --help

Usage of gobrot:
  -file string
    	The rendered mandelbrot image filname (default "mandelbrot.png")
  -height int
    	Rendered image height (default 768)
  -iteration int
    	Iteration count (default 800)
  -palette string
    	Hippi | Plan9 | AfternoonBlue | SummerBeach | Biochimist | Fiesta (default "Hippi")
  -radius float
    	Escape Radius (default 0.125689)
  -smoothness int
    	The rendered mandelbrot set smoothness. For a more detailded and clear image use higher numbers. For 4xAA (AA = antialiasing) use -smoothness 4 (default 8)
  -step float
    	Color smooth step. Value should be greater than iteration count, otherwise the value will be adjusted to the iteration count. (default 6000)
  -width int
    	Rendered image width (default 1024)
  -xpos x
    	Point position on the real axis (defined on x axis) (default -0.00275)
  -ypos y
    	Point position on the imaginary axis (defined on y axis) (default 0.78912)

Here are some options you can try out. (The attached images are generated using the below commands.)

$ go run mandelbrot.go -palette "Hippi" -xpos -0.0091275 -ypos 0.7899912 -radius .01401245 -file "mandelbrot.png"
go run mandelbrot.go -palette "Plan9" -xpos -0.0091275 -ypos 0.7899912 -radius .01401245 -file "test2.png" -iteration 600 -step 600
$ go run mandelbrot.go -palette "Vivid" -xpos -0.00991275 -ypos 0.7899912 -radius .02401245 -file "test3.png" -iteration 800 -step 600 -smoothness 10 -width 1920 -height 1080
$ go run mandelbrot.go -palette "Hippi" -xpos -0.00275 -ypos 1.012 -radius .089999 -file "test4.png" -iteration 800 -step 600 -smoothness 10 -width 1920 -height 1080
$ go run mandelbrot.go -palette "Hippi" -xpos -0.00275 -ypos 0.78912 -radius .1256789 -file "test5.png" -iteration 800 -step 6000 -smoothness 10 -width 1920 -height 1080

By combining -palette, -iteration and -step values you can obtain differently colorized mandelbrot sets.

Check out my article for more details: http://esimov.com/2016/04/mandelbrot-renderer-in-go


  • Generate various images with a single command
  • Find dynamically the regions where a deep zoom will emerge new mandelbrot sets