Proposal idea: Processing in Bash

edited March 2017 in Summer of Code 2017

This might sound strange but I've been working on a version of Processing built in Bash (it uses Imagemagick/Magickscript with X-Windows support for the rendering). I reviewed the summer of code and Processing threads and the project list and am wondering if this makes sense as a proposal to build it out further. (working title!!!) would be an implementation of the principles of Processing in Bash. The main premise is that with Processing (or alternatively Processing-like) syntax you create and modify images as well as do anything you could do in Bash. I think that Bash in one way could be considered esoteric or 'expert' functionality but it's my alternative premise that the Unix philosophy is a democratic model that potentially unlocks doors for artists, and that it has much to offer beginners as well. I have a first minimal version of the parser and am building out a reference of functionality. There are still some challenges (what should looping look like? how to get mouseX events?) but there are also some new exciting uses as well (relating to piping and other uses), and specifically how Processing in Bash could integrate with other software. Potentially this could be a new mode inside the PDE.

At this point I'm also wondering if it should have processing or Bash-like syntax, Fill(50, 20, 100, 70) or Fill 50 20 100 70 for example. I know that some of the versions of Design By Numbers for example did not have parenthesis.

I'd be open to hearing any feedback. Thanks



  • Thanks for this idea! As a reference take a look at how Processing Command Line works.

    I have worked on several projects where I need to run Processing to generate images on a "headless" machine (combined with a web server or some other technology). It often involves a lot of acrobatics to create a "fake" display. Making this easier for people could be interesting.

  • Interesting concept!

    I am trying to understand the basic paradigm. What would running a sketch do -- would it for example write an image or images to an output directory? That is, is about the saveX functions rather than draw(), animation, input, handlers and interactivity?

    Would using this be different from using the Java mode command line support?

  • edited March 2017

    Hi folks, thanks for the quick responses.

    Dan, I've used Processing-Java. It's great but I'm proposing something a little different as this would actually literally be written and running in Bash with ImageMagick powering it. It's like the differences between p5.js and processing.js It would be good for headless mode and any functionality that needs bash interoperability. Other reasons I'm excited about Bash are because it's old and will be around forever; it's a way of working that offers a potentially different paradigm or way of coding (input/output, KISS, small functionality, ability to use system or local $vars aliases, call other programs and functions, among other reasons.

    Jeremy, Here's my current working model (though open to change)

    • You can write a sketch (can include setup and/or draw loop or not)
    • You write many of the Processing options we know and love (see my earliest version of commands in the reference below) as well as you're able to use Bash functions
    • The image gets generated and rendered (in x-windows) and is also saved as probably a gif or jpeg by default but you could specify bmp, jpeg, pdf, gif, png, tif, psd, etc etc etc (there are dozens of options due to imagemagick)
    • Currently my setup is that the image is built/rendered at the end of the setup block, with all of the specified options from that block added in order
    • I am unsure how draw should work. It could be on a loop occurring every t number of seconds (and then would coalesce OR overlay depending on specification), or it could just render one additional time by default (this is how basil.js works for example)
    • I could potentially hook into ffmpeg for outputting video files instead of the moving gifs made using ImageMagick
    • Piping is potentially exciting. You could pipe an image into (or out of), potentially even specifying additional options.

    Thanks for any feedback. This is the very first version of my reference. I'll be building out more of the basic Processing commands. I'm still unsure if I should be using Processing-like parens or Bash-like just leave the parentheses and commas out and leave a space between everything.


    background(0) OR OR background (100, 0.5) OR background(20, 40, 120, 0.8)
    stroke(20) OR stroke (40, 100, 250) fill(0, 102, 150)




    x = 100
    x = 100.1
    x = "hello"
    arrayName=(Value1 Value2 Value3 ValueN)
    random (min value, max value)




    borrow from Bash or Processing?
    comment #
    debug echo


    functions - borrow from Bash


    NO! mouseX, mousePressed() at this time!



Sign In or Register to comment.