Processing: making art with code

This column is from The MagPi issue 56. You can download a PDF of the full issue for free, or subscribe to receive the print edition in your mailbox or the digital edition on your tablet. All proceeds from the print and digital editions help the Raspberry Pi Foundation achieve its charitable goals.

One way we achieve our mission at the Raspberry Pi Foundation is to find an intersection between someone’s passion and computing. For example, if you’re a young person interested in space, our Astro Pi programme is all about getting your code running on the International Space Station. If you like music, you can use Sonic Pi to compose songs with code. This month, I’d like to introduce you to some interesting work happening at the intersection between computing and the visual arts.

Image of Dead Presidents by Mike Brondbjerg art made with Processing

Mike Brondbjerg’s Dead Presidents uses Processing to generate portraits.

Processing is a programming language and development environment that sits perfectly at that intersection. It enables you to use code to generate still graphics, animations, or interactive applications such as games. It’s based on the Java programming language, and it runs on multiple platforms and operating systems. Thanks to the work of the Processing Foundation, and in particular the efforts of contributor Gottfried Haider, Processing runs like a champ on the Raspberry Pi.

Screenshot of Processing environment

When I want to communicate how cool Processing is while speaking to members of the Raspberry Pi community, I usually make this analogy: with Sonic Pi, you can use one line of code to make one note; with Processing, you can use one line of code to draw one stroke. Once you’ve figured that out, you can use computational tools such as loops, conditions, and variables to make some beautiful art.

And even though Processing is intended for use in the realm of visual arts, its capabilities can go beyond that. You can make applications that interact with the user through keyboard or mouse input. Processing also has libraries for working with network connections, files, and cameras. This means that you don’t just have to create artwork with Processing. You can also use it for almost anything you need to code.

Physical process

Processing is especially cool on the Raspberry Pi because there’s a library for working with the Pi’s GPIO pins. You can therefore have on-screen graphics interacting with buttons, switches, LEDs, relays, and sensors wired up to your Pi. With Processing, you could build a game that uses a custom controller that you’ve built yourself. Or you could create a piece of artwork that interacts with the user by sensing their proximity to it.

Processing screenshot

Best of all, Processing was created with learning to code in mind. It comes with lots of built-in examples, and you can use these to learn about many different programming and drawing concepts. The documentation on Processing’s website is very thorough and – as with Raspberry Pi – there’s a very supportive community around it if you run into any trouble. Additionally, the Processing development environment is powerful but also very simplified. For these reasons, it’s perfect for someone who is just getting started.

To get going with Processing on Raspberry Pi, there’s a one-line install command. You can also go to Processing.org and download pre-built Raspbian images with Processing already installed. To help you on your journey, there’s a resource for getting started with Processing. It includes a walkthrough on how to access the GPIO pins to combine physical computing and visual arts.

When you launch Processing, you will see a blank file where you can start keying in your code. Don’t let that intimidate you! All of the world’s greatest pieces of art started off as a raw slab of marble, a blob of clay, or a blank canvas. It just takes one line of code at a time to generate your own masterpiece.

Become a supporter

After this article appeared in The MagPi, the Processing Foundation put out a call for support:

We want you to be a part of this. Our work is almost entirely supported by individual one-time donations from the community. Right now we are outspending what we earn, and we have bigger plans! We want to continue all the work we’re doing and make it more accessible, more inclusive, and more responsive to the community needs.

To create lasting support for these new directions we’re starting a Membership Program. A membership is an annual donation that supports all this work and signifies your belief in it. You can do this as an individual, a studio, an educational institution, or a corporate partner. We will list your name on our members page along with all the others that help make this mission possible.

8 comments

Ken Warren avatar

Processing is a fun environment, it’s easy enough for relative newcomers to programming to hop in and start learning and you can do a lot in just a few lines of code. From the software point of view it’s community is similar to the Raspberry Pi & Arduino ones (there is a lot that will be familiar to people who have played with the Arduino in the IDE due to a shared history).
If you want a crash course in this cross over area I can’t recommend the Future Learn course https://www.futurelearn.com/courses/creative-coding highly enough (especially if you’ve done their Raspberry Pi course).

Marcelo avatar

I didn´t know this website! I’ve just joined It seems great! Thank you!

Gregory J Matthews avatar

Sir,

I had an idea for an art project and I thought raspberry pi would be useful. And then I come to the page and this is on the front page? Must be a sign.

Would it be possible to get in touch with the author of this article? I’m @statsinthewild on Twitter.

Cheers,
Greg

David Ferguson avatar

Matt gave a talk at the Raspberry Pi Birthday Event 2017 about using Processing, and if you want to see it, I recorded it and it’s online at https://www.youtube.com/watch?v=JG8rMDC8nAM&index=14&list=PL7hyZZT342t9TTjdWenohaCGjx_9pr8OY

John avatar

I think this programming language is quite good. It’s friendly and simple to use. The UI and design is also good. Plus it’s based on java.

Mike Cook avatar

And the next issue of the MagPi, I have a project that uses Processing. Also look in Mike’s Pi Bakery in the MagPi 49 for my first project:- Olympic Ribbons.

Bob Lee avatar

Yes, Processing is easy to understand and powerful. If you are more familiar with Javascript, I suggest you take a look at their sub-project: P5. It is very close to Process but in Javascript and can run directly in browser.

Robert avatar

This Program language is too good to use. I’ve followed many YouTube channels for creating cartoons with code which also give me new experiences.

Comments are closed