1

I'd like to decode a PNG on an ESP8266 and access to some pixels of the result. Has anyone got experience with PNG on Arduino? Is it feasible at all? I've done some research on PNG decoding libraries, found UPNG. Will check if it can be used in Arduino/ESP.

8
  • 3
    Is it feasable depends on the the size of your picture, where it stored, and how you want to store the decompressed data. On an ESP8266 you have ~40kB of free RAM and a decoded picture with RGBA8888 format (2 bytes per pixel) and 128x128 px will take 32kB to store the decompressed image. Notice that the libray always decodes whole pictures, not blockwise -- you must be able to fit the complete decoded image into RAM. Commented Mar 25, 2018 at 13:46
  • 1
    Thanks. Image comes from network stream, base64 encoded (urlData), with a maximum of 128x128 pixels size. I feel this is on the limits. Commented Mar 25, 2018 at 14:06
  • 4
    If you also have the base64 string of the compressed PNG in RAM (how much % of the original image size is that?), plus network / TCP buffers, this will be quite the tough call. You might have to change your logic to transfer smaller images (either resolution or pixel depth), or directly decoded images so you don't have to decode them. You might want to look into an ESP32 (512K RAM) or the ESP-WROVER (ESP32 + 4 MegaByte PSRAM) Commented Mar 25, 2018 at 14:11
  • 1
    With those small images and decompression overhead for png, I got the feeling you might be better of sending uncompressed bitmap images instead. Also try avoiding base64, as that makes things 30% larger, or decode the base64 on the fly. Commented Mar 25, 2018 at 15:42
  • 1
    UPNG is simple to port to a microcontroller. I just did it in an afternoon to run on a 200MHz PIC32MZ with 512kB RAM. It wouldn't run on an 80MHz PIC32MX with 32kB RAM. That's with a 100x100 pixel RGBA8 image. I need to test it with intermediate chips to see what the minimum memory for that image size is. Also that's with the image source held in flash. Commented Mar 25, 2018 at 18:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.