0

I am developing an app that downloads a png image from internet and displays it. For some reason gbitmap_create_from_png_data() fails to load most images with following error message:

[ERROR] gbitmap_png.c:49: PNG memory allocation failed

[ERROR] gbitmap_png.c:99: Failed to load PNG

I doubt that I am out of memory. I say this because I have tried loading very small images i.e 4Kb in size and they still fail. On the other hand some images, although 16kb in size, load successfully. Other confusing thing is that the same images that fail to load using gbitmap_create_from_png_data() load successfully using gbitmap_create_with_resource() if I add them as image resources to my app. So images are correctly formated for Pebble. The downloaded images are exactly the same size as the ones I have locally so I doubt the image data gets corrupted.

Successful image: http://brucedalemansion.com/images/baby_16.png

Un-Successful image: https://i.stack.imgur.com/k63v6.png

binW
  • 13,220
  • 11
  • 56
  • 69

1 Answers1

0

The un-successful image contained a transparency chunk (tRNS) with 0 entries. For the palette chunk (pLTE), this would be invalid by the specification. For the transparency chunk, it may be considered valid... as the PNG specification states "[equal] or less tRNS entries than there are palette entries".

Since some tool is making PNGs with this issue, I am adding support to our PNG decoder for it. I would be interested in what tool made that PNG image.

Matt from Pebble