Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esimov/gobrot
Mandelbrot image renderer in Go
https://github.com/esimov/gobrot
color-palettes fractal go golang image-processing mandelbrot
Last synced: 29 days ago
JSON representation
Mandelbrot image renderer in Go
- Host: GitHub
- URL: https://github.com/esimov/gobrot
- Owner: esimov
- License: mit
- Created: 2016-04-21T06:27:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-07-16T12:18:18.000Z (over 1 year ago)
- Last Synced: 2024-07-31T07:15:45.651Z (3 months ago)
- Topics: color-palettes, fractal, go, golang, image-processing, mandelbrot
- Language: Go
- Size: 21.4 MB
- Stars: 104
- Watchers: 6
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gobrot
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.
### Install
```
$ go install github.com/esimov/gobrot@latest
```### Run
Running `$ gobrot` will produce the following image:![sample](https://raw.githubusercontent.com/esimov/gobrot/master/images/test5.jpg)
```
$ gobrot --helpUsage 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.)
```
$ gobrot -palette "Hippi" -xpos -0.0091275 -ypos 0.7899912 -radius .01401245 -file "mandelbrot.png"
```
```
$ gobrot -palette "Plan9" -xpos -0.0091275 -ypos 0.7899912 -radius .01401245 -file "test2.png" -iteration 600 -step 600
```
```
$ gobrot -palette "Vivid" -xpos -0.00991275 -ypos 0.7899912 -radius .02401245 -file "test3.png" -iteration 800 -step 600 -smoothness 10 -width 1920 -height 1080
```
```
$ gobrot -palette "Hippi" -xpos -0.00275 -ypos 1.012 -radius .089999 -file "test4.png" -iteration 800 -step 600 -smoothness 10 -width 1920 -height 1080
```
```
$ gobrot -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
### TODO
- [ ] Generate various images with a single command
- [ ] Find dynamically the regions where a deep zoom will emerge new mandelbrot sets### Resources
- https://en.wikipedia.org/wiki/Mandelbrot_set
- https://en.wikibooks.org/wiki/Fractals/Iterations_in_the_complex_plane/MandelbrotSetExterior
- http://linas.org/art-gallery/escape/escape.html
- https://rosettacode.org/wiki/Mandelbrot_set
- https://youtu.be/2AZYZ-L8m9Q