Yep, a file offset is the position from the beginning of the file (in bytes)
- remember the first byte of a file is at offset 0.

Example:

File has the following data: 
abcdefghijklmnopqrstuvwxyz

offset 3: d
offset 5: f
offset 9: j

When working with tiff's, don't forget to check the byte order field in the
header at offsets 0-1.  It will be either 4D4D hex (MM ascii) for Motorola
ordering, also known as Big Endian; or 4949 hex (II ascii) for Intel
ordering, also known as Little Endian.  This is important when reading the
offsets from the file: MM has the most significant byte first, II has the
least significant byte first.  This is only important if this value
indicates a different format than the chip you are using (Motorola or
Intel).  If it is different, all short and long ints will need to have their
byte ordering reversed.

Examples:

Offset:Byte
00:02
01:04
02:0A
03:01
04:03

2 byte number (16 bit short int) at offset 0:
MM: 0204 hex = 516 dec
II: 0402 hex = 1026 dec

2 byte number (16 bit short int) at offset 1:
MM: 040A hex = 1034 dec
II: 0A04 hex = 2564 dec

4 byte number (32 bit long int) at offset 0:
MM: 02040A01 hex = 33819137 dec
II: 010A0402 hex = 17433602 dec

4 byte number (32 bit long int) at offset 1:
MM: 040A0103 hex = 67764483 dec
II: 03010A04 hex = 50399748 dec

If you're head's not spinning yet, let me know if you need a semi-efficient
algorithm to do this byte order reversal.

James

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of John Hebert
Sent: Thursday, July 22, 2004 9:29 AM
To: [email protected]
Subject: [brlug-general] What exactly is a "file off-set"?

Howdy,

I am trying to understand the TIFF file format and I
came across a term: "file off-set". I kinda have an
idea what this is, but I am not sure.

I think it referring to a position in the file where
actual image data starts, so that a header section can
exist to provide meta-data about the image. (?)

Can anyone define what a file off-set is or point me
to a good explanation?

Thanks,
John


        
                
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

_______________________________________________
General mailing list
[email protected]
http://brlug.net/mailman/listinfo/general_brlug.net

Reply via email to