Running Processing in Headless Mode (On a Mac)

I want to run Processing sketches from the terminal, and not have a display window show up.
Currently, I can run processing from the terminal using the processing-java command and save my files where I’d like to.

However, I’d like to run multiple such commands back to back without having to close the display window after every command, as it is the only thing that is keeping me from automating my workflow.

I have looked at this link, but it only works for Linux operating systems.

Is there way around this?
Worst case scenario that I can see is to import all the processing functionality into Java and then run the java files from the terminal? If this is the case, I would appreciate any useful links/tutorials that you guys might have links to, as I would be doing something like this for the first time. I am an inexperienced Java programmer.

Thank you for your time and help.

1 Like

Shameless self-promotion: here is a tutorial on using Processing as a Java library:

1 Like

Would the PApplet work without a settings() function?
Would it be possible to use Processing as a Java library and the save the output to a PGraphics file?

I’m pretty sure you need to settings() function if you’re using Processing as a Java library.

Sure, depending on what you mean by PGraphics file.

The best thing to do is just try it out and see what happens.

I didn’t express what I meant regarding the PGraphics file well. Anyways, it doesn’t matter.

Interestingly, I found the solution I needed in the PDF Export Library for Processing. They have an option to save to PDF without opening the display window!

Thank you for your help @Kevin

3 Likes