bitbank2/image_to_c

Adding "How to" to execute "iamge_to_c" in terminal

yankobogdan opened this issue · 6 comments

Hi. I found your library AnimatedGIF very useful for my project. And of course, I want to try with my own GIFs. I understand the purpose of this repository to convert GIFs to C array, but I am a little bit confused about how to use that.
I assume that I need to run image_to_c script in the terminal sending image that I want to convert the path as param, but I don't know how exactly to do it. I am using Mac OS.
I think it's would be very useful for others to have that short description on main page of the repository.
Thanks.

The image_to_c program (not a script) tells you how to use it if you run it with no parameters.

Hi bitbank2

may I ask you please to help me a little. Below the result of using your tool for converting a gif to C array.
Unfortunately it is doing something but not creating a file with content. What is it what I am doing wrong?

When I enter following in the Mac terminal.


ast login: Sun Dec 12 14:48:36 on ttys001
You have new mail.
....@.....-iMac ~ % open /Users/...../Desktop/...../Programmierung/image_to_c-master/dist/MacOS/image_to_c ./flame.gif > outtest.h
....@....-iMac ~ %

ast login: Sun Dec 12 14:50:14 on ttys000
You have new mail.
/Users/..../Desktop/..../Programmierung/image_to_c-master/dist/MacOS/image_to_c ; exit;
....@......-iMac ~ % /Users/......./Desktop/..../Programmierung/image_to_c-master/dist/MacOS/image_to_c ; exit;
image_to_c Copyright (c) 2020 BitBank Software, Inc.
Written by Larry Bank

Usage: image_to_c
output is written to stdout
example:

image_to_c ./test.jpg > test.h

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Prozess beendet]


It is creating a file but without content.

image

Hi @AlonsoMinas,
I just tested the latest code on my Mac (which I use for 99.99% of my work) and it works fine. I'm really not sure why the stdout generated by my program wouldn't get captured properly by a ">" redirect. Does it print the output to the terminal if you don't specify an output file?

Hi @AlonsoMinas,
I just tested the latest code on my Mac (which I use for 99.99% of my work) and it works fine. I'm really not sure why the stdout generated by my program wouldn't get captured properly by a ">" redirect. Does it print the output to the terminal if you don't specify an output file?

Hi Larry,

thank you for your answer and efforts with me. I have tried it like this:

...@...-iMac ~ % open /Users/.../Desktop/.../Programmierung/image_to_c-master/dist/MacOS/image_to_c ./flame.gif
...@...-iMac ~ %

Terminal is showing:

Last login: Sun Dec 12 18:44:00 on ttys001
You have new mail.
/Users/.../Desktop/.../Programmierung/image_to_c-master/dist/MacOS/image_to_c ; exit;
...@...-iMac ~ % /Users/.../Desktop/.../Programmierung/image_to_c-master/dist/MacOS/image_to_c ; exit;
image_to_c Copyright (c) 2020 BitBank Software, Inc.
Written by Larry Bank

Usage: image_to_c
output is written to stdout
example:

image_to_c ./test.jpg > test.h

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Prozess beendet]

When I search for test.h on my Mac there is no file found with this name. There must be something I am doing wrong?

But I have created attached two files with another tool in internet (https://lvgl.io/tools/imageconverter) may you check if this will work with your AnimatedGIF on a ESP32 ( I don't have it yet, is ordered otherwise I would try it my self).
If we cannot solve the problem and my files are not usable I will try it with a Windows computer.

Archiv.zip

Why are you using "open" to run the program? Just run it like any other command line program:

./image_to_c

Great worked thank you very much.