Need: Sample Code to read a JPG from SD and display on HUB75 Panel

Hi Friends,

I have a 3x (64 x 64) HUB75 panel running with a Teensy 4.1 and Smartmatrix Shield up and running. Serial connection and SD card working. I am now seeking an example code to read an image (jpg or png) from SD card and display it on the background layer. In a worst case, I could go for GIF, but that is only plan B. Any help is greatly appreciated.

This library should hopefully get you most of the way there:

Another option, if you are open to converting your image files, would be to use BMP format.

The nice thing is the format is usually uncompressed and in full 24-bit color resolution, so decoding is a piece of cake. BMP also supports an alpha (transparency) channel…

I can share some BMP decoding and compositing code if desired.

THX. Unfortunately - if I read it right - that library needs C binary code as a source. Quite bulky, and not readable with any tool. In this case, if I have to do a conversion anyway, I can use the working GIF decoding. But thanks for pointing it out. I’ll finish my project with the easy GIF way first and will check it out in the next phase.

Hi easone,

sounds interesting. I would have to convert my images *sniff*, but 24 bit color sounds tempting. If you had a simple “read from SD” and decode (*cough* in an ideal world to smartmatrix) , that would give me a point to start. THX

The slideshow example from the JPG library uses SD. It will require some adaptation though.

Take a look at this. WIP. Currently only works with ARGB32 BMP format, which is one of the export options provided by GIMP and Photoshop. I’m planning to add more formats soon.

Here’s a demo, a little bit late for Valentine’s Day.

I just published an update to this bitmap parser class. It now supports a wide range of uncompressed BMP formats including the ones exportable by GIMP and Photoshop: 1-bit monochrome, 4-bit and 8-bit indexed, 16-bit color (R5G6B5 and A1R5G5B5), 24 bit RGB, and 32 bit ARGB. Hope this might be useful to someone.