Reading and writing RGB pixel data on norns

I’ve just built a norns shield and I’d like to explore designing a visual sequencer. I’m aiming to import .PNG images, look at the RGB value of each pixel and convert that (in a user definable musical way) into an audio sequence. I would also like the user to be able to manipulate individual pixels and write that back to the PNG so that users could share their creations.

As it stands now, I can’t find a method to get or set the pixel data of an image. I’ve tried using imagemagick, but the command line implementation does not allow for pixel level manipulation. I started to try to implement imlib2 but can’t seem to get that to work either. Maiden throws an error as it is looking for resources that I don’t understand how to provide.

Is there any way to read/write pixel data from PNG files on the norns?

there isn’t a low-level image manipulation library for norns.

if there is a solution that either could be added to lua or executable from the command line, it’d be pretty straightforward to get it onto norns. imlib2 is a c lib which means some substantial hacking to get it integrated.

but perhaps someone else here has a better idea!

1 Like

There is a version of imagemagick that can read pixel RGB values here:

The method for getting a pixel is there, but I don’t see one for setting a pixel.

Norns uses Cairo for graphics and there are read/write png functions, but they’re simple and limited.

The Cairo website mentions:

Applications which need more control over the generated PNG file should access the pixel data directly, using cairo_image_surface_get_data() or a backend-specific access function, and process it with another library, e.g. gdk-pixbuf or libpng.

1 Like

Would I need to invoke that via the command line?