When writing a jpg image to uart, the number of bytes transmitted by the uart is much smaller than image.size(). The bytes sent by the uart appear to be a complete jpg image file as the uart transmission begins with Start of Image (0xFF, 0xD8) and ends with End Of Image (0xFF, 0xD9). Some examples of jpg image.size() and number of uart bytes transmitted using quality=30, 50 and 10:
It’s very likely something on the receiving end, maybe an overflow. The same function used to get the image size is the same one used when returning a buffer for reading (i.e. when you call uart.write(img)). Also these numbers (~700 bytes) can’t be valid JPEG images.
Just to note on this, we have DMA accelerated UARTs. If you use a protocol analyzer you’ll see that once we start sending data it’s sent back-to-back with no breaks at all. If your receiving processor doesn’t have DMA support then it’s likely it can’t handle a higher baud rate as there will be no pauses in the data sent.