GithubHelp home page GithubHelp logo

tomaz-suller / draw-with-shapes Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 141 KB

A simple Python srcipt to draw on top of images using randomly placed geometric shapes.

License: GNU General Public License v3.0

Python 100.00%

draw-with-shapes's Introduction

Draw with Shapes

A Brazilian flag drawn with regular hexagons

A simple Python srcipt to draw on top of images using randomly placed geometric shapes. This was adapted from ishihara_generator by @franciscouzo

Colours can be applied based on:

  • Geometric rules (i.e. by mathematically descrobing a region in 2D space)
  • An image on top of which the geometric motive will be generated

Requirements

The script was tested on Python 3.6.9.

Usage

python3 draw_with_shapes.py

The script can be interrupted during its execution and the image will still be generated. This feature is included since it's hard to estimate a good number of shapes to use in the image, so manual interruption when the script slows down (due to image filling up) is often necessary.

Configuration

No CLI options are currently avaliable, though all relevant settings for a user who doesn't want to dive too deeply into the code should be located at the top of the script.

If you simply wish to draw over iy, you must set the flag DRAW_OVER_IMAGE to True and DRAW_OVER_IMAGE_PATH to the path to the image. It should be noted any pixel which is not completely black (for images without an alpha layer) or completely transparent (for images with an alpha layer) will be drawn over using the same palette according to the current implementation.

The function calculate_circle_colour should be of particular interest and should be modified if you wish to draw anything other than the Brazilian flag.

Currently the most obscure setting in the script is how to draw circles. It is done by setting NUMBER_OF_SIDES_PER_SHAPE to None.

To-Do's

  • Remove hard coded Brazilian flag drawing
  • Add options for multiple draw over images with multiple different colours
  • Add CLI options

draw-with-shapes's People

Contributors

tomaz-suller 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.