Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Generative Art in Go: httpd server and cli command line

License

NotificationsYou must be signed in to change notification settings

paulohrpinheiro/genart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generative Art in Go: httpd server and cli command line

Generate images (patterns) from a simple formula:

color = ( C - C * X * Y ) mod MAX

C is a constante, ``(X, Y)` coordinates and MAX the number of colors.

How to use

cmd line

To get help:

$ bin/genart -helpUsage of bin/genart:  -colors int    number of colors (default 216)  -constant int    constant for formula (c): c-c*x*y (default 10)  -filename string    filename to save image (.png) (default "formulaimg.png")  -formula string    formula to use (default "ccxy")  -size int    size of image (default 1000)

Generating an image:

$ make genart$ bin/genart -filename output.png -colors 100

http server

To get the same image from above cmd line example:

make runserver

Then, on another terminal (or from browser):

$ curl -v http://127.0.0.1:8090/ccxy/size/1000/constant/10/colors/100/ --output output.png

The image

Generatedimage

Another images

formula: ccxy, size:1000, constant:20, colors:200
$ curl -v http://localhost:8090/ccxy/size/1000/constant/20/colors/200/ --output images/ccxy_size:1000_constant:20_colors:200.png$ bin/genart -formula=ccxy -size=1000 -constant=20 -colors=200 -filename=images/ccxy_size:1000_constant:20_colors:200.png

Formula ccxy, size 1000, constant 20, colors 200

formula: xcyc, size:1000, constant:2, colors:70
$ curl -v http://localhost:8090/xcyc/size/1000/constant/2/colors/70/ --output images/xcyc_size:1000_constant:2_colors:70.png$ bin/genart -formula=xcyc -size=1000 -constant=2 -colors=70 -filename=images/xcyc_size:1000_constant:2_colors:70.png

Formula xcyc, size 1000, constant 2, colors 70

formula: ccxy, size:1000, constant:2, colors:70
$ curl -v http://localhost:8090/ccxy/size/1000/constant/2/colors/70/ --output images/ccxy_size:1000_constant:2_colors:70.png$ bin/genart -formula=ccxy -size=1000 -constant=2 -colors=70 -filename=images/ccxy_size:1000_constant:2_colors:70.png

Formula ccxy, size 1000, constant 2, colors 70

Previous works (pt-br)

About

Generative Art in Go: httpd server and cli command line

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp