GithubHelp home page GithubHelp logo

notisrac / filetocarray Goto Github PK

View Code? Open in Web Editor NEW
102.0 102.0 33.0 69 KB

Coverts any file to a C style array. (It can also do image color format and size coversion)

Home Page: https://notisrac.github.io/FileToCArray

License: MIT License

HTML 46.76% CSS 5.35% JavaScript 47.89%
arduino array convert file file-to-array image image-convert

filetocarray's People

Contributors

antumdeluge avatar notisrac avatar shylie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

filetocarray's Issues

Only small images are converted correctly

Hello, a TFT display control library has an example of using this PNG image to binary file converter. But it only works when the image is small.

// This example renders a png file that is stored in a FLASH array
// using the PNGdec library (available via library manager).

// Note: The PNGDEC required lots of RAM to work (~40kbytes) so
// this sketch is will not run on smaller memory processors (e.g.
// ESP8266, STM32F103 etc.)

// Image files can be converted to arrays using the tool here:
// https://notisrac.github.io/FileToCArray/
// To use this tool:
// 1. Drag and drop file on "Browse..." button
// 2. Tick box "Treat as binary"
// 3. Click "Convert"
// 4. Click "Save as file" and move the header file to sketch folder
// 5. Open the sketch in IDE
// 6. Include the header file containing the array (panda.h in this example)

https://github.com/Bodmer/TFT_eSPI/blob/master/examples/PNG%20Images/Flash_PNG/Flash_PNG.ino

Bodmer/TFT_eSPI#3185

Lost bytes

50x50

If I take the basic 50x50 image that is attached here, both my C++ (Arduino) and an online tool are showing data corruption.
Basically a vertical line | is being skewed to /.

download

This can be tested my uploading the attached 50x50 jpg to the online example https://notisrac.github.io/FileToCArray/ then taking the HEX output and test the conversion back to an image online here https://mischianti.org/images-to-byte-array-online-converter-cpp-arduino/.

Oddly, the example Google.ico in the readme seems to work perfectly.

I have tested both jpg and bmp and was thinking it was me for 2 days until I started to count bits and tested the github test against converters.

Expected output can be created here https://www.digole.com/tools/PicturetoC_Hex_converter.php

These are the expected and actual arrays.

expected.txt
actual.txt

I'm happy to help out in any way that I can, this is a great tool to have JS get images into the correct format for e-Ink displays.

signed char mode doesn't work

see https://notisrac.github.io/FileToCArray/

When selecting "Code format" "Decimal (000)" and NOT "unsigned" (i.e. it should be signed values) and
"Data type" "char" or "int8_t", then the Result should NEVER contain values like 250, 202, etc - since these should be
negative numbers! (or there should at least be an option to allow that output)

needing include guards

Very good tool!
I add include guards into the generated header files directly adding them to my project.
It would be nice having them added by the tool.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.