This topic is now archived and is closed to further replies.

Making own files?

This topic is 5971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

you define a header that has some info about the file like
color depth width and height
then you just store the colordata

type Header
width as long
height as long
bpp as byte
end type

type color_data
r as integer
g as integer
b as integer
end type

then you just save one heard and width*height color data blocks and there you have it

Sorry about the Spelling..

Share this post

Link to post
Share on other sites
The best advise that I could give you is to look at a few examples of graphic file formats. You can start by going to the Win32 documentation by microsoft and search for BITMAP. The BMP and PCX file formats are fairly simple to learn. From there, you could come up with your own.


Share this post

Link to post
Share on other sites
as file is a file is a file is a file...
BAsically a file contains bytes, and it''s up to you to figure out what they mean. A JPEG is not a JPEG because you stick .JPG to the end of the filename... it''s a JPEG because if you read the bytes contained in the file, they are *organised* in way that is specific to JPEG.
What VBLimits means by "header" is this.
Generally, a file format is composed of the header part and the data part.
The header part are the first bytes contained in a file, they are used to say "hello, I am a JPEG file, so this is how we are gonna work". It gives you some info in a way that is specific to the file format you are using.
Typically, the first few bytes are a signature... check a GIF file for instance, with Notepad. You''ll see the first bytes are ... "GIF89a" hehe
Then, since you know what file format you are looking at, you know where to find the stuff you want.
Things like "is this a 256 colours file ?", things like "where is the palette?" (e.g. in a PCX file, you''ll find the palette data at EndOfFile - 768, i.e. the last 768 bytes of the file.), or "what are the dimensions of the file?"
Generally the header is of a fixed size, say 256 first bytes of the file. Then you get the data. Because you have grabbed the width and height of the picture in the header, you will read data until you have enough pixels... (Ok, at least that''s for the PCX file format, it can varies).

So now, all you need is to find the structure of the file format you want to read, and read the files you wanna read
check out you''ll find tons and tons of file formats described there !

If you don''t understand, ask again. Though I think this should be in another forum.
(See guys, that''s why I wanted us to have another moderator... digisoap NEVER moves those lost threads away... )

Sancte Isidore ora pro nobis !

Share this post

Link to post
Share on other sites