#176151 - Prowess - Tue Apr 19, 2011 8:03 pm
Hey guys, is there a way to convert from C code to an image? For example, let's say that I use usenti to convert an image to C, but if I accidentally deleted the image, can I load the .c and .h files into a program to have it recreate the image?
Thanks!
#176152 - Ruben - Tue Apr 19, 2011 8:11 pm
Theoretically, you could compile the .c file into a raw binary file and then find a way to put the data to use (ie, write a program that will read that info and create, say, a .bmp out of it).
#176153 - Dwedit - Tue Apr 19, 2011 8:13 pm
I'd say the easiest way is to take a screenshot of it.
Or extract it out of a binary.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#176154 - Prowess - Tue Apr 19, 2011 8:25 pm
Well, I wanted to do it for a sprite sheet that I had made. I'm not sure how to compile it and extract it from a binary source like you guys mentioned. I'm using Visual C++, so could I take that one file (or two, since there's a sprite.c and a sprite.h and compile it?
Thanks!
#176155 - Ruben - Tue Apr 19, 2011 8:27 pm
You can compile the data with any gcc compiler (I'm not so sure about MSVC).
Code: |
gcc -c -otmp yourFile
objcopy -O binary tmp OutFile.raw |
#176156 - Prowess - Tue Apr 19, 2011 8:49 pm
Ruben wrote: |
You can compile the data with any gcc compiler (I'm not so sure about MSVC).
Code: | gcc -c -otmp yourFile
objcopy -O binary tmp OutFile.raw |
|
I'll give it a whirl sometime later. Thanks!