gif to binary data

hi all i m using a 240*128 pix lcd with t6963c controller wanna see the graphics in it lcd is interfaced with atmega 128 microcontroller

for graphics i thougt of converting the gif file to binary data so did this i had 1st save the gif file in to the txt so to get ascii data before i aslo tried direct gif to binary i m getting binary data rite acording to the txt file but when i m seeing this data in the lcd i m not getting that image infact i had discarded the 22 bytes from the data

#include #include #include typedef unsigned char byte; #define SIZEBMP 3840 #define SIZELCD 42240 static int i; int ig,jg; unsigned char tg; int y; char kg[8]; void convert(void); //byte getvertByte(int ,int bit); unsigned char getbits(unsigned x, int p, int n); byte count, arrayLCD[SIZELCD], arrayBmp[SIZEBMP]; main() { clrscr(); FILE *fp;

/* open the bitmap for reading in binary mode */

if ( (fp = fopen("\\compass22.txt", "r")) == NULL) { fprintf(stderr, "Error opening file."); }

fp = fopen("\\compass22.txt", "r"); fread(arrayBmp, sizeof( byte), SIZEBMP, fp); for(ig=0;ig

Reply to
tanu
Loading thread data ...

Op Wed, 13 Sep 2006 13:50:35 +0200 schreef tanu :

Is that a question? If not, and you omitted an "I" then the obvious remedy is: try looking at the display while it is faced upwards.

Which gif file? Which binary format do you intend to use?

Which txt? How?

Please rephrase this part, using proper sentences and without "rite", which is not a word.

Which 22 bytes? Why did you discard them?

Which platform was this code designed to run on? What did you expect of the program?

You are wrong in the assumption that we are your personal slaves. You are wrong in the assumption that most people will easily understand what you are talking about.

--
Gemaakt met Opera's revolutionaire e-mailprogramma:  
http://www.opera.com/mail/
Reply to
Boudewijn Dijkstra

I am sorry, but I'm unable to understand what exactly you have tried to do here.

A GIF file is a graphics file in a specific format that you need to parse to get the image. See

formatting link
for the GIF file format. But you may want to start of with something like the BMP format as it is much easier to decode (also see wotsit for the format).

This is a non-standard header, what is your platform?

240 * 128 / 8

Where does this number come from?

Why are these variable global?

int main(void)

Binary mode? --> "rb"

Program gets here if open suceeded or not

Open again? That will probably fail.

Ok file now closed, your indentation makes it seem like it's in a loop, but it's not.

Now you do something on an error,

But you als open the file twice, why? And in different modes this time.

You are not parsing the graphics file properly, read the stuff on wotsit. Your variable names seem to suggest you are using the BMP format but you say you are using GIF.

--
Stef    (remove caps, dashes and .invalid from e-mail address to reply by mail)
Reply to
Stef

By assigning 3840 bytes for the Bitmap buffer I assume you are using 1 bit per pixel black and white. I can't see a reason why the LCD array is the size it is 42240 bytes or why you need to define it. A frame buffer of 3840 will be plenty by itself.

The files would definitely have to be treated as binaries when opening, although you shouldn't have to convert anything - fopen will handle that.

The gif won't map directly to your bitmap buffer - you will need to decode it. Why don't you start with a bitmap file until you get the hang of the display and then move onto compressed formats like gif.

Do you mean that 22 bytes of the data were missing from the buffer or did you purposefully discard them. If so, why? Is this you stripping off the header?

If you use bitmap data then you can just copy the data section of the file straight to the buffer. In windows bitmaps, the 32bit word in the

11th, 12th, 13th and 14th bytes of the file tells you how far from the start of the file the data begins.

Your code could really use some comments and some more meaningful variable names.

You may need "rb" in your fopen to open the file as a binary file. Other than that then you should have the binary data where you want it but I'm not convinced it will be data in the form you think it should be.

And for goodness sake use capital letters and apostrophes - you're a big boy now.

Reply to
Tom Lucas

Thanks alot for help and ur suggetion to me now i'll take care while wrtiting anything actually i m new to google group so dont know and was bit in hurry to write here now ll xplain all the thing properly after 3 hr bye thanx a lot bye

Reply to
tanu

Don't use silly abbreviations in usenet. Do capitalize the first letters in sentences and the personal pronoun I. Do terminate sentences with periods. Failure to spell things properly simply marks you as childish and makes your articles hard to read. Most won't bother to read them.

You are not using google groups, you are using usenet. Google only supplies a very poor interface to the usenet system.

--
"I have a creative mind.  You (singular) are eccentric.
 He is insane.          We are losing sight of reality.
 Click to see the full signature
Reply to
CBFalconer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.