lwip
lwip copied to clipboard
Getting "Invalid PNG buffer" for a valid image
The image is valid, but lwip can't understand it. Where should we start debugging?
:bell: @EyalAr
Can you please upload the original image?
Otherwise I'd try to open this image with libpng's example program.
@EyalAr I uploaded it here (note I will remove it once the issue is fixed or obsolete).
This is still happening, any idea what the fix is/was? what to do?
@gabox8888 I think it's still an issue... @EyalAr :bell:
@EyalAr :bell: Please....!
I can confirm this is happening with perfectly valid .PNG's.
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 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
I can confirm that changing the affected PNG's file extension to jpg indeed fixes the problem.
But still, lwip should be smart enough to detect the image buffer type (and not by using the extension).
@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.