Giraffe generator made for Motorola Science Cup contest
Project was created on Linux where configuration shouldn't cause much problems.
python3
is required to run run.py
script.
There shouldn't be a problem with main
, but libpng
may be required.
Use run.py
script if you want to enter parameters manually.
You can also import the script and use a provided function to automate it.
The other way is to write directly to stdin of main
.
There are two types of examples:
*.py
- those are run withpython3 {example-file}
*.txt
- those are run with./main < {example-file}
basic_input.txt
---
giraffe - name of the file
512 512 - width and height
1 - scale
0 - giraffe type (Reticulated giraffe)
0 - skip colors customization
0 - skip patches customization
colored_giraffe.txt
---
colored_giraffe.png - name of the file
512 512 - width and height
2.0 - scale
3 - giraffe type (Kordofan giraffe)
1 - customize colors
202 127 79 - patch color
232 223 202 - gap color
112 74 56 - middle color
237 208 144 - secondary color
0 - skip patches customization
Generator (main
) reads parameters from stdin in the following format:
{general parameters}
0 | (1 {color parameters})
0 | (1 {patch parameters})
Note: All parameters are in relation to 512x512 image. Image size 'crops' and has no effect on the pattern
filename {string}
- of result imagewidth {uint}
- of result imageheight {uint}
- of result imagescale {float}
- scales area of texture elementsgiraffe index {uint}
- number between 0 and 8 representing giraffe
patch {color}
- overall, average color of a patchgap {color}
- space between the patchesmiddle {color}
- color deeper inside the patch, usually darkersecondary {color}
- adds some variation
Size
scale {float}
- scale of patch area - greater scale = bigger patches and fewer of them(min and max) gap {float}
- how far apart the patches aremin to max area ratio {float}
- measure of how different in size the patches arestandard deviation {float}
- size is randomly selected with normal distribution
Edges - created by adding noise to generated patches.
Each property has 3 values: frequency {float}
, strength {float}
, octaves {uint}
distortion
- controls bigger indents in the patchroughness
- more local than distortion and has weaker effect
(min and max) count {uint]
- how many spikes should a patch have(min and max) depth {float}
- how far into patch the spike extends(min and max) width {float}
- width (thickness) of the spike
c++20
libpng
andlibpng-config
python3
version3.6+
- optionally
Pillow
formosaic.py
Running make
build main
program.