Maximum image size saveable from offscreen buffer?

Hi folks,

I’m trying to verify and understand the maximum image size that can be saved from an offscreen createGraphics() buffer. Here’s a sketch I used to test it.

I should fail at about the 5th file. Be patient, it takes a few seconds to download these large image files.

The limit seems to be exactly 2 ^ 30 pixels, which makes some sense. If a pixel takes 4 bytes (R,G,B, possibly alpha), then that would be 2 ^ 32 bytes which would be an understandable limit to have.

I can’t find any documented limit in the p5.js doco, or the Java Processing doco. This is all in the context of creating very high-resolution art files for a digital print shop.

I’d be interested if anyone has any detail on the limit, the reasons behind it etc.

You might think that 2^30 pixels, eg. a 22370 x 12000 image here, should be enough for anybody, but it’s not all that big in today’s digital printing world.

My environment: Mac, Mojave 10.14.6, Chrome 83.0.4103.116

Thanks & Regards,
Greg E

Sorry folks, the code I posted doesn’t currently reproduce the problem, ie. it doesn’t download the png files. I actually ran the tests on my local Mac and just posted the code without running it, dumb. I’ll try to get it working, but anyway if you want to run the code, try it on your local machine. Ciao.

Hi Greg,

Java Virtual Machine has a setting for amount of memory and naturally you can change it. In processing environment there is a text file for loads of settings that are not available from PDE. I think you can set JVM memory size larger than amount of physical memory, but then system will swap memory and everything slows down.

I’m quite positive that browser has similar setting for javascript environment

Well it is a lot. You can make a three meter wide print with excellent quality or six meter wide with good enough quality. With multiple displays or projectors that’s enough for 6-8 8K displays and I don’t think you attach any more displays to a single computer.

I’m curious @grege2 when do you need even larger canvases?

Hi @SomeOne, thanks for the comments.

My print shop (specialty Fine Art printers) said they just print 300 DPI, and they can print 44 inch or 60 inch width. And they can print any length you want, it’s a rolling print thing like they do these days. (And you need to leave a border, less than an inch say). So my 12000 x 22000 image would be 40 inches x 73 inches, which is big certainly but reasonably routine I think for digital gallery-quality art.

That’s the plan anyway !


300 DPI gives superb quality that you can look at very close distances. Obviously an image that’s two meters wide is looked at couple of meters away and then 100DPI is quite enough. I have printed images with 90 DPI with Epson SP 9900, which is 44 inch fine art printer and they were still quite ok. I would go with 180 DPI with Epson or 200 DPI with Canon fine art printer. They will still produce gallery-quality prints. Then again my experience is mostly from photographs and digitally created images may behave differently.

Then again print shop should know what they are doing. I would look for another print shop that is not stuck with overly high image quality requirements.

Hi @SomeOne, thanks, that’s useful. The place may have lower res options, I might have set the wrong expectation by stating I needed absolute best quality. I’m going to go see them soon, check out all sorts of samples etc. Cheers.

1 Like