avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] Storing B&W bitmap images into Flash : file format sugges


From: Daniel O'Connor
Subject: Re: [avr-chat] Storing B&W bitmap images into Flash : file format suggestion ?
Date: Wed, 13 Jan 2010 13:05:40 +1030
User-agent: KMail/1.9.10

On Wed, 13 Jan 2010, Vincent Trouilliez wrote:
> On Wed, 13 Jan 2010 10:56:03 +1030
>
> "Daniel O'Connor" <address@hidden> wrote:
> > Starting to sound like too much work IMO :)
>
> Yeah, I think I will just write my own little C programme to convert
> the picture into a C array of bytes. I now fancy doing it regardless,
> just as a little exercise... and it's just cool to build his own

I attached one earlier in this thread which converts a PNG into a raw 
file.

The raw file has no header, just 1 bit per pixel (ie each byte is 8 
pixels).

This means you don't need any parsing code in your program.

> tools I find ! I mean, can't be that complex, just need to figure out
> how to read a binary file on Linux.

fopen/fread/fwrite.

There is no distinction between binary and other files.

> > FreeBSD comes with 'file2c'
> > http://svn.freebsd.org/viewvc/base/head/usr.bin/file2c/file2c.c?rev
> >ision=200462&view=markup
>
> I guess this does what I stated above ? It must read a file fro the
> disk, but for the life ofd me I can't see any instruction/command
> related to reading/opening files in this piece of code.. I must be
> blind ?! :-/
> Anyway, I will just search for some Linux C tutorial (I assume the
> commands to handle files/disks are specific to Linux, so a Windows
> C tutorial won't do !...)

file2c takes a binary file and converts it into C source code.

If you took my program (png2bmap) and then ran file2c on the output you 
would have a C array containing the binary you need.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]