sirleech/Webduino

webduino/web_image/png to C data structure

Closed this issue · 2 comments

library of webduino/web_image about this statement "this data was taken from a PNG file that was converted to a C data structure by running it through the directfb-csource application" how am i suppose to convert image file to c data. i tried to convert online on http://www.digole.com/tools/PicturetoC_Hex_converter.php it didn't work.

The directfb-csource program I used when I wrote this is at https://github.com/deniskropp/DirectFB/blob/master/tools/directfb-csource.c. I had built it for other work and used the --raw parameter to tell it to just dump the file directly to the header. I suspect that http://www.codeproject.com/Tips/845393/Convert-a-Binary-File-to-a-Hex-Encoded-Text-File will also work -- you need something that just gives you raw, comma-separated hex values that you can then insert into the variable declaration in the C source. This is done because Arduino sketches don't have a file system, just embedded data, so if you want to serve something that looks like a file, you need to just include it as constant data.

Thank you.