lwip icon indicating copy to clipboard operation
lwip copied to clipboard

Getting "Invalid PNG buffer" for a valid image

Open IonicaBizau opened this issue 9 years ago • 12 comments
trafficstars

The image is valid, but lwip can't understand it. Where should we start debugging?

IonicaBizau avatar Jan 20 '16 17:01 IonicaBizau

:bell: @EyalAr

IonicaBizau avatar Jan 29 '16 09:01 IonicaBizau

Can you please upload the original image?

Otherwise I'd try to open this image with libpng's example program.

EyalAr avatar Feb 08 '16 17:02 EyalAr

@EyalAr I uploaded it here (note I will remove it once the issue is fixed or obsolete).

IonicaBizau avatar Feb 08 '16 19:02 IonicaBizau

This is still happening, any idea what the fix is/was? what to do?

gcemaj avatar Feb 14 '16 05:02 gcemaj

@gabox8888 I think it's still an issue... @EyalAr :bell:

IonicaBizau avatar Feb 14 '16 05:02 IonicaBizau

@EyalAr :bell: Please....!

IonicaBizau avatar Feb 21 '16 10:02 IonicaBizau

I can confirm this is happening with perfectly valid .PNG's.

acoyfellow avatar Mar 20 '16 15:03 acoyfellow

Just a little update: in my case, it was a JPG file, with the png extension.

@acoyfellow Double check if your image is really a PNG file or it's just a valid image but with a wrong extension. Some programs may display it correctly, but when parsing it you must specify the type.

IonicaBizau avatar Mar 20 '16 15:03 IonicaBizau

@IonicaBizau thanks for the tip. I did realize that was happening for some cases.

But I still get this error with iOS generated .PNG files from screenshots, when uploading files via fetch (using React Native).

Edit: Yeah, weird iOS specific bug I suppose. Screenshots are saved in camera roll as .PNG's, but lwip throws invalid PNG buffer. I rename the file to jpg, and it works. I suppose this has nothing to do with lwip.

Thank you very much for all the hard work all contributors have put in. <3

acoyfellow avatar Mar 20 '16 15:03 acoyfellow

I can confirm that changing the affected PNG's file extension to jpg indeed fixes the problem.

ChristianRich avatar Apr 12 '16 05:04 ChristianRich

But still, lwip should be smart enough to detect the image buffer type (and not by using the extension).

IonicaBizau avatar Apr 12 '16 05:04 IonicaBizau

@IonicaBizau That would certainly be a nice feature, that the type is determined not by the file extension but the header. Still I find the workaround perfectly acceptable. As long as you can intercept the error and handle it I'm fine.

ChristianRich avatar Apr 12 '16 12:04 ChristianRich