Image does not fit the frame buffer

Hi,
I am using H7 R2, and trying to upload a photo and work on it for debugging purposes. I understand that I should use BMP format but am unable to upload the image properly.
Adding the code and the image i’m using. I have also an sd card inside the module.
I can only upload jpg here but I converted it to bmp using this site:

This is the code:

# Copy image to framebuffer.
#
# This example shows how to load and copy an image to framebuffer for testing.

import sensor, image, time

# Still need to init sensor
sensor.reset()
# Set sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)

# Set sensor pixel format
sensor.set_framesize(sensor.VGA)
sensor.set_pixformat(sensor.GRAYSCALE)

# Load image
img = image.Image("/pool.bmp", copy_to_fb=True)
img.draw_line((100,100,400,100), color = (255, 0, 0))
# Add a small delay to allow the IDE to read the loaded image.
time.sleep_ms(500)

What’s the error? The image is too big, then you need to make it smaller.

The error is what’s written in the headline. What’s the maximum size that can be handled? And is there an option to use other file types?
Thanks

hi there,

you have already declared the frame to be vga resolution.
this means that maximum size can handle will be 640x480.
You can change sensor.set_framesize(sensor.VGA) to much your creteria or import vga res images.

Note that if you ask for a larger image than the camera has RAM for it will just crop the image coming in to keep working.

What is the maximum size that can be handled for H7 R2 without it begin cropped?
This is the link to the file i’m using:

I get this error using the file:
OSError: Unexpected value read!

# Copy image to framebuffer.
#
# This example shows how to load and copy an image to framebuffer for testing.

import sensor, image, time

# Still need to init sensor
sensor.reset()
# Set sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)

# Set sensor pixel format
sensor.set_framesize(sensor.VGA)
sensor.set_pixformat(sensor.GRAYSCALE)

# Load image
img = image.Image("/picture.bmp", copy_to_fb=True)
img.draw_line((100,100,400,100), color = (255, 0, 0))
# Add a small delay to allow the IDE to read the loaded image.
time.sleep_ms(500)

Also I am saving the file(~300kB) in a memory card attached to the device(if it matters)

Just try a VGA image size and the code will work out the maximum result.

As for the error, what line? Please, forums are a two way street. Posting, it doesn’t work and then not being specific about what is wrong won’t help me help you.

Oh, okay, I see, you are not using the sensor API.

I apologize, responding to a lot of forum posts from folks putting minimal effort in.

Yeah, we don’t have the smart controls on loading the image yet. So, this is more failure prone.

I think you should be able to do a grayscale VGA image or QVGA with RGB565. There’s a lite 400KB of space available