Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By matkar
#23635 To correct the missing images substitute function:
void handle_image() with
Code: Select allvoid handle_image() {
  WiFiClient client = server.client();
  client.write(image, sizeof(image));
  server.send(200, "image/png", "");
}


I was searching for an application that would transform png images to the necessary byte array. Unfortunately I couldn't find any. If anybody knows where to get one, please let us know.

For smaller pictures the parsing can be done manually with the help of some tools. I used http://www.fileformat.info/tool/hexdump.htm online service to convert my PNG to hex. I copied the result to libreoffice writer where I removed the unnecessary portions (columns) and added "0x" columns and commas to the array. This way it takes only a few minutes for a small picture to adapt it to the correct format.

Regards,
Mat
User avatar
By martinayotte
#23648
matkar wrote:I was searching for an application that would transform png images to the necessary byte array. Unfortunately I couldn't find any. If anybody knows where to get one, please let us know.


There is Hexy : https://github.com/tristan2468/Hexy/

But, unfortunately, the Linux binary isn't there any more.
User avatar
By martinayotte
#23653 For those on Linux, you will need to install "lazarus" and compile it yourself. Since I didn't want to mess around "lazarus-ide", I've used the following command line to get it compiled :

Code: Select all/usr/bin/fpc  -MObjFPC -Scgi -CX -O3 -OoREGVAR -Xs -XX -vewnhi -l -Fibuild -Fu/usr/lib/lazarus/0.9.30.2/lcl/units/x86_64-linux -Fu/usr/lib/lazarus/0.9.30.2/lcl/units/x86_64-linux/gtk2 -Fu/usr/lib/lazarus/0.9.30.2/packager/units/x86_64-linux -Fu. -FUbuild/ -FEbuild/ -ohexy -dLCL -dLCLgtk2 hexy.lpr