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:
img.size() → # UART Bytes
4571 → 705
6018 → 604
3214 → 638
Is this a bug in the image.size function, or is there another function to obtain the actual number of bytes that will be transmitted for a jpg image?
img = sensor.snapshot().compress(quality=30) print("Size Image:", img.size()) uart3.write(img)