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.

🎨 Generate and change color-schemes on the fly.

Generate and change color-schemes on the fly. Pywal is a tool that generates a color palette from the dominant colors in an image. It then applies the

dylan 6.9k Jan 03, 2023
Deep Illuminator is a data augmentation tool designed for image relighting.

Deep Illuminator Deep Illuminator is a data augmentation tool designed for image relighting. It can be used to easily and efficiently genera

George Chogovadze 52 Nov 29, 2022
Make your master artistic punk avatar through machine learning world famous paintings

Master-art-punk Make your master artistic punk avatar through machine learning world famous paintings. 通过机器学习世界名画制作属于你的大师级艺术朋克头像 Nowadays, NFT is beco

蒋虎成 23 Jan 04, 2022
A tool to maintain an archive/mirror of your Google Photos library for backup purposes.

Google Photos Archiver Updated Instructions 8/9/2021 Version 2.0.6 Instructions: Download the script (exe or python script listed below) Follow the in

Nick Dawson 116 Jan 03, 2023
🎶😤 Generate an image indicating what you are listening to 😳

I'm Listening to This (song that I've sent you an image about detailing its metadata in a nifty way) Few lines describing your project. 📝 Table of Co

Connor B - Viibrant 4 Nov 03, 2021
This projects aim is to simulate flowers(Gerbera Daisy) phyllotaxis.

phyllotaxis This projects aim is to simulate flowers(Gerbera Daisy) phyllotaxis. Take a look at the arrangement of this flower's seeds, this project's

amirsalar 3 Dec 10, 2021
Image generation API.

Image Generator API This is an api im working on Currently its just a test project Im trying to make custom readme images with your discord account pr

Siddhesh Zantye 2 Feb 19, 2022
Nudity detection with Python

nude.py About Nudity detection with Python. Port of nude.js to Python. Installation from pip: $ pip install --upgrade nudepy from easy_install: $ eas

Hideo Hattori 881 Jan 06, 2023
Nutrify - take a photo of food and learn about it

Nutrify - take a photo of food and learn about it Work in progress. To make this a thing, we're going to need lots of food images... Start uploading y

Daniel Bourke 93 Dec 30, 2022
display: a browser-based graphics server

display: a browser-based graphics server Installation Quick Start Usage Development A very lightweight display server for Torch. Best used as a remote

Szymon Jakubczak 205 Oct 17, 2022
Convert bitmap images to seeds for Tiny-83 NFT project.

What is this? This tool allows you to convert any 14p high and 22p wide Bitmap (.bmp) to the seed needed for the Tiny-83 NFT project. Project Twitter:

shib_maximalist 1 Oct 31, 2021
Seeks to remove text from an image in a convincing way.

Text-Removal This is a Computer Vision project that seeks to successfully remove text from an image by covering the text areas in a convincing way. He

6 Nov 22, 2022
An executor that wraps 3D mesh models and encodes 3D content documents to d-dimension vector.

3D Mesh Encoder An Executor that receives Documents containing point sets data in its blob attribute, with shape (N, 3) and encodes it to embeddings o

Jina AI 11 Dec 14, 2022
The aim is to extract timeseries water level 2D information for any designed boundaries within the EasyGSH model domain

bct_file_generator_for_EasyGSH The aim is to extract timeseries water level 2D information for any designed boundaries within the EasyGSH model domain

Clayton Soares 1 Jul 08, 2022
将位图转为彩色矢量 svg 图片

一个将位图描摹为彩色矢量 svg 图片的程序,是一个命令行工具,使用 Python 脚本实现,运行环境 Python3.8+。 ✨ 效果 以一个字帖图片为例,这是 png 格式的位图(370KB): 这是颜

Haujet Zhao 104 Dec 30, 2022
Anime2Gif - an algorithm that detects scenes in a video and generates gifs from it

Anime2Gif Anime2Gif is an algorithm that detects scenes in a video and generates gifs from it. How to use To use it, first, you'll need to install it'

1 Dec 09, 2021
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
cmdpxl: a totally practical command-line image editor

cmdpxl: a totally practical command-line image editor Features cmdpxl has many exciting functionalities, including Editing pixels one at a time! Savin

Jieruei Chang 475 Dec 23, 2022
Image Reading, Metadata Conversion, and Image Writing for Microscopy Images in Python

AICSImageIO Image Reading, Metadata Conversion, and Image Writing for Microscopy Images in Pure Python Features Supports reading metadata and imaging

Allen Institute for Cell Science - Modeling 137 Dec 14, 2022
A Robust Avatar Generator with a huge number of templates

CoolAvatars Welcome to this repository of CoolAvatars. Using this project, you can generate cool avatars not only from the samples present in my image

RAVI PRAKASH 5 Oct 12, 2021