Paynter

PaYnter is a Python module that let you procedurally generate images with handy features that emulates what you can find in any image editing software like Photoshop, GIMP, Krita, etc...

2019-11-28

The journey

A while back, I started to make generative art with a little python script that automated mouse and keyboard input to interact with Krita, a digital drawing tool. I liked the complexity of the brushes and all the tool available inside Krita, but after few generations it started to feel pretty hacky and uncomfortable to use. So after that, I wanted to try and replicate that brush complexity typical of popular image editors from scratch in a python program. This was the spark that started the development of PaYnter.

Brushes emulation

With PaYnter you draw on your digital image with brushes just like you do on programs like Photoshop. You can create brushes starting from images defining the brush tip, and then you can define a bunch of brush parameters like:

  • Size

  • Spacing

  • Angle

  • Color mixing

  • Hue

  • Saturation

  • Color Value

  • Random position offsetting

Layer management

Each image is composed by one or multiple layers. Each layer internally is a 3D array of [imageWidth imageHeight 4] to store the RGBA value of each pixel of the layer. When drawing you specify which layer is the active one, and then when you are done with the editing you can then merge all the layers using various blend modes to create different effects.

Palette management

You can choose color individually or use one of the PaYnter preset palette generation where you can specify some starting values and generate opposite or complementary colors from the starting one. Each color can then be tweaked individually from saturation, hue, and value.

First Stop

The project first got discontinued when I realize that it was too slow and, even through many optimization iterations the performance wasn't enough for my needs. I used a lot of matrix operation which could have been optimized a lot by using the GPU, but sadly it seems that all the decent framework for that uses an nVidia drivers and I don't have an nVidia GPU, so that was not an option.

Newer developments

In 2022, I come back to this project to experiment with it a little bit more. I managed to make it run faster with some GPU hardware acceleration and extended to let it generate small animations frame by frame. This gave me the chance to further explore the style that I previously discovered and iterate on it with other shapes and new weird and fun effects.

External Links

- PaYnter Documentation: https://paynter.readthedocs.io/en/latest/
- PaYnter Repository: https://github.com/elkiwy/paynter