PNG Rotation after loading via lodepng


I’m attempting to load PNG files at run time from the file system. That works nicely. However it seems that loading from the lodepng PNG Decoder treats images as an object instead of an image. This is preventing me from rotating the loaded image on a canvas.

If this is totally the wrong way to approach the problem, please tell me. Pre processing an image into a C array via the online tool and then loading it does work. I was just trying to make it so that the images are configurable and could be swapped out at at run time.

What MCU/Processor/Board and compiler are you using?

RaspberryPi 4

What do you want to achieve?

Load PNG from file via PNG Decoder, rotate it via lv_canvas_rotate.

What have you tried so far?

Added PNG Decoder based on lodepng from LittlevGL to my project and compiled. I’m able to load a PNG as seen in the demos. However when attempting to rotate the PNG with canvas rotate, the PNG loaded from PNG Decoder does not do anything.

When loading PNG from C Arrays created by the online converter, the PNG rotates as expected.

Code to reproduce

I cannot run this in the simulator as it is part of a port into a different language.

In dev-7.0 it’s possible to rotate an image object (using a canvas isn’t necessary). Do you need other canvas features, or is rotation enough?

For 6.1, there isn’t an easy mechanism to load decoded image files into a canvas at the moment. The logic for drawing decoded images is here. You could potentially modify that to draw to a canvas instead.

Thank you for your reply. Your insights are very much appreciated!