ESP32-CAM sending images with MQTT

I am making an OCR project where i send images captured with my esp32-cam to my raspberry pi where i do OCR also store the image and a small database about the images and cameras itself. I want to send images with MQTT because i am also using MQTT to send configuration files config.json to my ESP32-Cam's i have more than one and i configure them from my raspberry.

Now here's the thing, while i am doing ocr i convert images to grayscale, ESP32-Cam has an ability to take pictures in grayscale format with config.pixel_format = PIXFORMAT_GRAYSCALE;

Now would it be better to send images captured with config.pixel_format =PIXFORMAT_GRAYSCALE; or config.pixel_format =PIXFORMAT_JPEG; ?

While sending the images with MQTT connection i have to change images to the Base64 format, JPEG images i capture are generally 250kb, while grayscale might be 800kb but would it give me better image quality if i do this so my ocr result would be better?

Thanks for any help.

If you capture directly in PIXFORMAT_GRAYSCALE, you get the best possible grayscale image straight from the ESP32-CAM without unnecessary conversions. If you can handle the bandwidth and MQTT transmission time, grayscale raw (PIXFORMAT_GRAYSCALE) is better for OCR accuracy.If you care about latency and MQTT efficiency, then JPEG is a better choice.

But why ?

The MQTT Lib on ESP32 is tailored to send HEX file (of the frame buffer) just fine, typically using this script here

  mqtt.beginPublish(mqtt_topic_to_send, fb->len, false);
  mqtt.write((const uint8_t*)fb->buf, fb->len);
  int aa = mqtt.endPublish();