vsketch is a Python generative art toolkit for plotters

Overview

vsketch

python Test Documentation Status

What is vsketch?

vsketch is a Python generative art toolkit for plotters with the following focuses:

  • Accessibility: vsketch is easy to learn and feels familiar thanks to its API strongly inspired from Processing.
  • Minimized friction: vsketch automates every part of the creation process (project initialisation, friction-less iteration, export to plotter-ready files) through a CLI tool called vsk and a tight integration with vpype.
  • Plotter-centric: vsketch is made for plotter users, by plotter users. It's feature set is focused on the peculiarities of this medium and doesn't aim to solve other problems.
  • Interoperability: vsketch plays nice with popular packages such as Numpy and Shapely, which are true enabler for plotter generative art.

vsketch is the sum of two things:

  • A CLI tool named vsk to automate every part of a sketch project lifecycle::
    • Sketch creation based on a customizable template.
    • Interactive rendering of your sketch with live-reload and custom parameters.
    • Batch export to SVG with random seed and configuration management as well as multiprocessing support.
  • An easy-to-learn API similar to Processing to implement your sketches.

This project is at an early the stage and needs contributions. You can help by providing feedback and improving the documentation.

Installing and Running the examples

The easiest way to get started is to obtain a local copy of vsketch's repository and run the examples:

$ git clone https://github.com/abey79/vsketch
$ cd vsketch

Create a virtual environment and activate it:

$ python3 -m venv venv
$ source venv/bin/activate

Install vsketch:

$ pip install .

You are read to run the examples:

$ vsk run examples/quick_draw

Additional examples may be found in the author's personal collection of sketches.

Getting started

This section is meant as a quick introduction of the workflow supported by vsketch. Check the documentation for a more complete overview.

Open a terminal and create a new project:

$ vsk init my_project

This will create a new project structure that includes everything you need to get started:

$ ls my_project
config
output
sketch_my_project.py

The sketch_my_project.py file contains a skeleton for your sketch. The config and output sub-directories are used by vsk to store configurations and output SVGs.

Open sketch_my_project.py in your favourite editor and modify it as follows:

None: vsk.vpype("linemerge linesimplify reloop linesort") if __name__ == "__main__": SchotterSketch.display() ">
import vsketch

class SchotterSketch(vsketch.SketchClass):
    def draw(self, vsk: vsketch.SketchClass) -> None:
        vsk.size("a4", landscape=False)
        vsk.scale("cm")

        for j in range(22):
            with vsk.pushMatrix():
                for i in range(12):
                    with vsk.pushMatrix():
                        vsk.rotate(0.03 * vsk.random(-j, j))
                        vsk.translate(
                            0.01 * vsk.randomGaussian() * j,
                            0.01 * vsk.randomGaussian() * j,
                        )
                        vsk.rect(0, 0, 1, 1)
                    vsk.translate(1, 0)
            vsk.translate(0, 1)

    def finalize(self, vsk: vsketch.Vsketch) -> None:
        vsk.vpype("linemerge linesimplify reloop linesort")

if __name__ == "__main__":
    SchotterSketch.display()

Your sketch is now ready to be run with the following command:

$ vsk run my_project

You should see this:

image

Congratulation, you just reproduced Georg Nees' famous artwork!

Wouldn't be nice if you could interactively interact with the script's parameters? Let's make this happen.

Add the following declaration at the top of the class:

class SchotterSketch(vsketch.SketchClass):
    columns = vsketch.Param(12)
    rows = vsketch.Param(22)
    fuzziness = vsketch.Param(1.0)
    
    # ...

Change the draw() method as follows:

    def draw(self, vsk: vsketch.Vsketch) -> None:
        vsk.size("a4", landscape=False)
        vsk.scale("cm")

        for j in range(self.rows):
            with vsk.pushMatrix():
                for i in range(self.columns):
                    with vsk.pushMatrix():
                        vsk.rotate(self.fuzziness * 0.03 * vsk.random(-j, j))
                        vsk.translate(
                            self.fuzziness * 0.01 * vsk.randomGaussian() * j,
                            self.fuzziness * 0.01 * vsk.randomGaussian() * j,
                        )
                        vsk.rect(0, 0, 1, 1)
                    vsk.translate(1, 0)
            vsk.translate(0, 1)

Hit ctrl-S/cmd-S to save and, lo and behold, corresponding buttons just appeared in the viewer without even needing to restart it! Here is how it looks with some more fuzziness:

image

Let's play a bit with the parameters until we find a combination we like, then hit the Save button and enter a "Best config" as name.

image

We just saved a configuration that we can load at any time.

Finally, being extremely picky, it would be nice to be able to generate ONE HUNDRED versions of this sketch with various random seeds, in hope to find the most perfect version for plotting and framing. vsk will do this for you, using all CPU cores available:

$ vsk save --config "Best config" --seed 0..99 my_project

You'll find all the SVG file in the project's output sub-directory:

image

Next steps:

  • Use vsk integrated help to learn about the all the possibilities (vsk --help).
  • Learn the vsketch API on the documentation's overview and reference pages.

Acknowledgments

Part of this project's documentation is inspired by or copied from the Processing project.

License

This project is licensed under the MIT license. The documentation is licensed under the CC BY-NC-SA 4.0 license. See the documentation for details.

QR-code Generator with a basic GUI.

Qr_generator_python Qr code generator with a basic GUI. ❔ About the QR-Code-Generator This project Generates QR codes to sites, e-mails and plain text

Tecixck 2 Oct 11, 2021
Graphical tool to make photo collage posters

PhotoCollage Graphical tool to make photo collage posters PhotoCollage allows you to create photo collage posters. It assembles the input photographs

Adrien Vergé 350 Jan 02, 2023
Python binding to Skia Graphics Library

Skia python binding Python binding to Skia Graphics Library. Binding based on pybind11. Currently, the binding is under active development. Install Bi

Kota Yamaguchi 170 Jan 06, 2023
A python script for extracting/removing exif data from images by @AbirHasan2005

Image-Exif A Python script for extracting exif metadata from images. How to use? Using this script you can extract exif data from image and save in .c

Abir Hasan 13 Dec 16, 2022
Dynamic image server for web and print

Quru Image Server - dynamic imaging for web and print QIS is a high performance web server for creating and delivering dynamic images. It is ideal for

Quru 84 Jan 03, 2023
A quick and dirty QT Statusbar implementation for grabbing GIFs from Tenor, since there is no offical or unofficial one I found. This was intended for use under Linux, however it was also functional enough on MacOS.

Statusbar-TenorGIF App for Linux A quick and dirty QT Statusbar implementation for grabbing GIFs from Tenor, since there is no offical one and I didnt

Luigi DaVinci 1 Nov 01, 2021
A Blender add-on to create interesting meshes using symmetry

Procedural Symmetries This Blender add-on automates the process of iteratively applying a set of reflection planes to a base mesh. The result will con

1 Dec 29, 2021
Convert the SVG code to PNG and replace the line by a call to the image in markdown

Convert the SVG code to PNG and replace the line by a call to the image in markdown

6 Sep 06, 2022
Convert HDR photos taken by iPhone 12 (or later) to regular HDR images

heif-hdrgainmap-decode Convert HDR photos taken by iPhone 12 (or later) to regular HDR images. Installation First, make sure you have the following pa

Star Brilliant 5 Nov 13, 2022
GIMP script to export bitmap as GRAPHICS 4 file (aka SCREEN 5)

gimpfu-msx-gr4.py GIMP script to export bitmap as GRAPHICS 4 file (aka SCREEN 5). GRAPHICS 4 specs are: 256x212 (or 256x192); 16 color palette (from 5

Pedro de Medeiros 4 Oct 17, 2022
Image enhancing model for making a blurred image to be somehow clearer than before

This is a very small prject which helps in enhancing the images by taking a Input images. This project has many features like detcting the faces and enhaning the faces itself and also a feature which

3 Dec 03, 2021
An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents

Mylar Note that feature development has stopped as we have moved to Mylar3. EOL for this project is the end of 2020 and will no longer be supported. T

979 Dec 13, 2022
A functional and efficient python implementation of the 3D version of Maxwell's equations

py-maxwell-fdfd Solving Maxwell's equations via A python implementation of the 3D curl-curl E-field equations. This code contains additional work to e

Nathan Zhao 12 Dec 11, 2022
Simple program to easily view Euler parameters in 3D.

Simple program to easily view Euler parameters in 3D.

5 Aug 20, 2021
With this simple py script you will be able to get all the .png from a folder and generate a yml for Oraxen

Oraxen-item-to-yml With this simple py script you will be able to get all the .png from a folder and generate a yml for Oraxen How to use Install the

Akex 1 Dec 29, 2021
A tool for making simple-style text posters or wallpapers with high resolution.

PurePoster PurePoster is a fancy tool for making arbitrary-resolution, simple-style posters or wallpapers with text in center. Functionality PurePoste

Renyang Guan 4 Jul 09, 2022
Quickly 'anonymize' all people in an image. This script will put a black bar over all eye-pairs in an image

Face-Detacher Quickly 'anonymize' all people in an image. This script will put a black bar over all eye-pairs in an image This is a small python scrip

Don Cato 1 Oct 29, 2021
missing-pixel-filler is a python package that, given images that may contain missing data regions (like satellite imagery with swath gaps), returns these images with the regions filled.

Missing Pixel Filler This is the official code repository for the Missing Pixel Filler by SpaceML. missing-pixel-filler is a python package that, give

SpaceML 11 Jul 19, 2022
QR Code Generator

In this project, we'll be using some libraries to instantly generate authentic QR Codes and export them in various formats

Hassan Shahzad 3 Jun 02, 2022
Generate different types of random avatars.

avatar-generator Generate different types of random avatars. Requirements Python3 pytorch=1.6 cv2=3.4 tqdm 1. Github-like avatars python generate_gi

Ming 11 Apr 02, 2022