Coder Social home page Coder Social logo

imagiraffe's Introduction

Giraffe generator by rybka ๐ŸŸ plum

Giraffe generator made for Motorola Science Cup contest

Project was created on Linux where configuration shouldn't cause much problems.

Usage

Requirements

python3 is required to run run.py script. There shouldn't be a problem with main, but libpng may be required.

Running

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.

Examples

There are two types of examples:

  • *.py - those are run with python3 {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

Format

Generator (main) reads parameters from stdin in the following format:

{general parameters}
0 | (1 {color parameters})
0 | (1 {patch parameters})

Parameter order

Note: All parameters are in relation to 512x512 image. Image size 'crops' and has no effect on the pattern

General

  • filename {string} - of result image
  • width {uint} - of result image
  • height {uint} - of result image
  • scale {float} - scales area of texture elements
  • giraffe index {uint} - number between 0 and 8 representing giraffe

Colors

  • patch {color} - overall, average color of a patch
  • gap {color} - space between the patches
  • middle {color} - color deeper inside the patch, usually darker
  • secondary {color} - adds some variation

Patches

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 are
  • min to max area ratio {float} - measure of how different in size the patches are
  • standard 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 patch
  • roughness - more local than distortion and has weaker effect

Spikes

  • (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

Code

Requirements

  • c++20
  • libpng and libpng-config
  • python3 version 3.6+
  • optionally Pillow for mosaic.py

Running make build main program.

Images

Reticulated giraffe

s0-0 s0-1 s0-2 s0-3 s0-4

s0-5 s0-6 s0-7 s0-8 s0-9

West African giraffe

s1-0 s1-1 s1-2 s1-3 s1-4

s1-5 s1-6 s1-7 s1-8 s1-9

Nubian giraffe

s2-0 s2-1 s2-2 s2-3 s2-4

s2-5 s2-6 s2-7 s2-8 s2-9

Kordofan giraffe

s3-0 s3-1 s3-2 s3-3 s3-4

s3-5 s3-6 s3-7 s3-8 s3-9

Angolan giraffe

s4-0 s4-1 s4-2 s4-3 s4-4

s4-5 s4-6 s4-7 s4-8 s4-9

South African giraffe

s5-0 s5-1 s5-2 s5-3 s5-4

s5-5 s5-6 s5-7 s5-8 s5-9

Rothschild giraffe

s6-0 s6-1 s6-2 s6-3 s6-4

s6-5 s6-6 s6-7 s6-8 s6-9

Thornicroft giraffe

s7-0 s7-1 s7-2 s7-3 s7-4

s7-5 s7-6 s7-7 s7-8 s7-9

Masai giraffe

s8-0 s8-1 s8-2 s8-3 s8-4

s8-5 s8-6 s8-7 s8-8 s8-9

Mosaic

m

Elemental giraffes

blue-giraffe green-giraffe

fire-giraffe air-giraffe

Custom

custom-giraffe1 custom-giraffe2

imagiraffe's People

Contributors

mhorod avatar

Stargazers

Adam Novak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.