PixelWrench ::

Image creation and manipulation toolkit..

Basic Introduction

So PixelWrench started like most of my projects as a tool to easily write pixels to a surface and save that surface to a file. Originally the main goal was to generate a frame of black and white static and then possibly compile those frames into a video stream. There are a few projects that could accomplish this, but none of them exactly fit the bill for what I wanted to accomplish.

 

Package Name Website
Cairo https://cairographics.org/
OpenCV https://opencv.org/
Cinder https://libcinder.org/
PyCairo https://cairographics.org/pycairo/
Processing https://processing.org/
ImageMagic https://www.imagemagick.org/
Magic++ https://www.imagemagick.org/Magick++/
GD https://libgd.bitbucket.org/pages/about.html

 

I wanted to try to create the application myself in a scripting language that felt comfortable and expressive, and I already had a decent set of C++ classes of boilerplate code for AngelScript integration. The project quickly moved passed being able to set a pixel on a surface to a full fledged image processing and drawing scripting language, expanding into areas like computer vision and video frame extraction and creation. It became a sandbox for manipulating images as matrices and applying text and vector rendering layers.

I have made every effort not to use non-platform specific code, application is currently building on win32 and Linux64.

Dependencies

PixelWrench leverages a multitude of open source libraries to accomplish different tasks:

Development Environment

Mingw/Msys/Gcc

Code::Blocks

Libraries

Boost 1.45 Cairo
Cairomm
FreeImage
FreeImagePlus
FreeType
x264
libAV
librSVG
AngelScript
OpenCV

 

The environment for running pskrit files is very dependency heavy ( around 100mb ) in order to support all the features I wanted. LibAV codec is 40mb on it's own.

Features

 

WARNING: Every attempt has been made to catch and report exceptions but since exceptions do not propagate across shared library boundaries dependencies still can throw an unhandled exception that crashes the application. I've done my best to make sure data passed to external libraries is properly sanity checked but the possibility still exists for an external lib to bring down the environment. If you report a crash any shared library information would be helpful.

The main script in PixelWrench is called a pixelSkrit file:

doSomething.pskrit

pskrit files can contain includes called ' lug ' files:

tests.lug

so a basic pskrit file may look like:

Of course since PW includes a fully compliant C99 preprocessor, all the macro functionality is available to you ( https://en.wikipedia.org/wiki/C_preprocessor ). For vector rendering PW leverages Cairo, so an overview of the Cairo framework is useful ( https://cairographics.org/samples/ )

For example using cairo to create a shape and save it as a png file:

Creating images is similar:

Loading and manipulating an image:

Supported image formats:

Freeimage image mainipulation:

Channel separation: red / green / blue

Invert:

Flip:

Using OpenCV to filter: before / blur / dialate

Pulling frames from a video

video test

Creating gradients:

SVG rendering:

String objects have basic regular expression support in 4 functions:

*see the DirScanner example for usage

Searching for files:

Searching for files uses the predicate idiom and the AngelScript interface functionality.

First define a class that will handle when a file name is matched:

Then pass the class to the scanner, and run it:

Output:

Processing supported file: Lake Street Dive Plays _I Want You Back_ On a Boston Sidewal.mp4

Interactive Remote Debugger

You can initiate a remote debugging session by using the switch -d with a port number, and then use the HTML client to connect and step though code:

  • Debugger

    Interactive remote debugger with HTML intercace, base on asPEEK

Status

Right now the toolkit is in early alpha stage. A lot more work needs to be done, and there are a large number of important functions stubbed out. Once the source has had some time to stabalized and I have a decent stack of documentation and examples I will post it all here for people to download and play around with. For now I just wanted to get a future home set up for this project.. Check back occationally to find out if it is ready

A few years ago the tool was rewritten to be used as a Python module on Windows and Linux still maintaining it C++ core. Most recently ported to Rust and utilizing the Rune scripting language.