(buffer size) Little printer with the ESP8266

Hi everyone!!

I’m triying to make a little printer (http://littleprinter.com/) with the ESP8266 module (ESP-01).

The Arduino recieves serial data directly from the ESP module, I’m making a simulation right now with processing to manage large ammount of information sent by serial.

one image (152x152 pixels) has 2888 bytes to be sent (stored in a char array).

but the serial in my arduino is only 64 bytes, right now these are my codes. what is the best approach to achieve this?

I’ve seen that some people hack the hardwareSerial.h and change the 64 byte buffer to 256, I don’t know if there is a max number for this buffer.

should I sent 64 bytes at a time and read them one by one?

Is there any other way to do it?

Thak you genius people!!!

import processing.serial.*;
int inByte;
int cont=0;
char foto_152 [] = {
  0x75, 0x55, ...(lots of hex elements erased so I can paste the code here, there are 2888 hex numbers in this array)
};

//2888 elementos

Serial arduino;

void setup() {
  arduino = new Serial(this, "COM8", 9600);

}

void draw() {


  while (arduino.available () > 0) {

    inByte = arduino.read();

    println(hex(inByte, 4));
  }
}

void keyPressed() {
  arduino.clear();
  arduino.write('a');

  for (int i =0; (i<= (foto_152.length)-1); i++) {
    arduino.write(foto_152[i]);
  }
}

Arduino Code:

byte inByte;  
int index = 0;
int sz = 0;
unsigned char foto [3000];

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  if (Serial.available() > 0)
  {
    delay(7000);
    inByte = Serial.read();

    if (!primerByte) {
      primerByte = true;
      //sz = inByte - 48;
      sz=2888;
    }

    for (int i = 0; (i <= (sz - 1)); i++) {
    
      foto[i] = Serial.read();

     delay(10);
    }
  }
  for (int i = 0; (i <= (sz - 1)); i++) {
    Serial.write(i);
    Serial.write(foto[i]);
    delay(10);
  }
  delay(10000);
}