*
* *
*
scene.org
Log in:
login for 1 year
No account? register here

Scene.org is hosted and supported by:
Scene.org is sponsored by:
* forum - #coders

*
Topic:  conversion bmp 2 hex
* Posted by ipe Wednesday 1 September 2004 - 8:24 
Hi guys,
i need to convert bmp data to hex format looking somehow like this:


-----(cut here)-----

#define LENGTH 1000

static unsigned char bmp1[]=
{
0x47,...

-----(/cut here)-----


any good tool for doing that for me?

* Posted by kusma Wednesday 1 September 2004 - 14:10 
save as .raw (photoshop can do that), and use a bin2h-program to make a header file from the file.

(bin2h.c following)

#include

int main( int argc, char *argv[] ) {
int input;
char *name = "data";

if (argc > 1) name = argv[1];

printf( "unsigned char %s[] = {\n", name );

while ((input = getchar()) != EOF) {
printf( "%i,", input );
}

printf( "\n};\n" );
return 0;
}

* Posted by psenough Wednesday 1 September 2004 - 17:00 
http://ourworld.compuserve.com/homepages/r_harvey/bin2inc.zi p

* Posted by selmaguzel Monday 30 June 2008 - 15:34 
Hi,
I am a new member.
I have downloaded bin2inc.zip.
And i have saved a bmp file as ppm extension.
But i haven't been able to understand what i must do now.
Could you tell clearly again?
Sorry for repeating some things.
Thanks.
P.S: I want to do the same thing as ipe.
Namely, to convert a bmp file to hex directory.
like:
{
0x47,...} as ipe said.

[Post edited by selmaguzel on Monday 30 June 2008 - 15:36]


* Posted by psenough Monday 30 June 2008 - 18:50 
please rtfm
bin2inc.txt is quite clear

* Posted by selmaguzel Tuesday 1 July 2008 - 13:48 
Hi,
I don't know why but i got "Could not open the source " error when i run the command as below:
BIN2INC a.txt b.inc

But it is not a problem now.Because i have found a program as bmp2T and i have gotten what i have wanted.Namely a c++ header file for bmp which includes hex format.

*