Closed frankcohen closed 3 years ago
Unfortunately I am unable to debug this for you. It appears the the data is not a valid JPEG file. The file should start with FF D8, hence the data is not being recognised as a valid JPEG file.
Thank you Bodmer, that helps in itself. I don't know anything about JPEG file formats. I'm going to focus on getting the canvas to give a valid jpeg image. -Frank
Picojpeg is great. I found it embeded in Bodmer's JPEGDecoder https://github.com/Bodmer/JPEGDecoder/blob/master/src/picojpeg.h and used to display images on a 135x240 pixel OLED display.
I created a 10x10 pixel JPEG encoded image from a Javascript context using this code:
I am using FHessel's HTTPS Server on ESP32 to receive the form post from a Chrome browser.
https://github.com/fhessel/esp32_https_server
Here is my form post handler code for the server side:
The upload works, stores the file in the ESP32 SPIFFS file system (using LittleFS) and here are the file contents (printed out as ASCII character and Hex value):
Picojpeg rejects the file and throws error 19.
I tested Picojpeg using a jpeg file I created in Pixelmator for Mac and Picojpeg works fine. I use the same HTTPS Server code to upload the file contents. I use this HTML:
This uploads the Jpeg file correctly. And Picojpeg decodes the jpeg image correctly and with no error.
I'm not sure where to go next? Any help would be appreciated.
-Frank