I tried the search bar but couldnt find a clear answer. Im confused on what I need to type to have my code make the brain read the Jpeg or PNG file. I also was curious what type of SD card to buy to upload the file to the brain? Any tips or even a link to a solution would help.
To make use of the SD Card slot, you need to have a MicroSD Card formatted with the FAT32 file system. The V5 Brain only supports .bmp
and .png
files, so you won’t be able to draw any JPEG images.
C++
// image.png is in the root directory of the SD card
// 0, 0 are the x and y pixel coordinates where the image will be drawn
Brain.Screen.drawImageFromFile("image.png", 0, 0);
Python:
brain.screen.draw_image_from_file(“image.bmp”, 0, 0)
Thank you so much for the info i will try it today!
Just going to add this in here:
If you look in the thread I have linked below, you do not exactly have to load a image from a file. You do have the option to draw a image from a buffer.
To convert a png to a buffer, use this link: Online image converter - BMP, JPG or PNG to C array or binary | LVGL. Make sure to set the color format to CF_RAW so that it works correctly. Then make a uint8_t array with the contents of the conversion as the array values. Then simply pass that to the brain::lcd::drawImageFromBuffer function and voila.
If any of what I just explained confuses you, or you want further explanation, please look in the thread I have linked below.
Is it possible to directly upload a picture into the brain for it to access?
If you don’t want to use a MicroSD Card, you may want to check this out: