Modify PGraphics pixels array to be larger?

I’m working on a sketch which composites 60 large images into a single extra-large image.

However, I’m hitting an ArrayIndexOutOfBounds when I initialize the PGraphics object with the required dimensions (65628 x 35292), which I think is being thrown bc the total number of pixels (2,316,143,376) is causing some kind of length problem with the pixels array (or its associated initialization functions)?

I have two questions here: (1) Has anyone made a library which handles images this size? and/or (2) if not, would the thing to do here be to create a new class which extends PGraphics and replaces INTs with FLOATs (or something? It’s been a while since I’ve gone under the hood like this).

Happy to hear any alternatives or ideas y’all may have. Thanks in advance!
– Devin

Hello @DSW,

This is the best I could get and took a few minutes to execute:

Memory usage:

Code:

// https://en.wikipedia.org/wiki/2,147,483,647
// 2^31-1 = 2,147,483,647
//int  signed 32 bits  -2147483648 to 2147483647

PGraphics pg;

void setup()
  {
  size(500, 500, P3D);
  pg = createGraphics(65536, 32767);
  println(65536*32767); //2147418112

  println(2147483647); // max size
  
  pg.beginDraw();
  pg.clear();
  pg.endDraw();
  
  pg.loadPixels();
  
  println(pg.pixels.length);
  println("Done!");
  }

I could not go over a maximum size of an int:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

I also had to gin into preferences and increase memory:

image

Interesting number:

:)