On Oct 11, 2006, at 2:02 PM, Dixon, Tom wrote:
Has anyone on the list done any work using Structures for reading
and storing image header information of JPEG and TIFF images?,
(and possibly others)
REALbasic structures will not work for this... the data is of
variable length and only a few tags are required as part of the
JPEG and TIFF specs.
Hmmmmm... Then how does one read the header info if it doesn't
appear at the specified offset set out in the specs?
A JPEG is broken up into segments and identified by Markers. For
example a &hFFD8 marker identifies the beginning of JPEG data, and
&hFFD9 marks the end of the JPEG data. Immediately following the
Start marker (FFD8), the first segment starts with a value of marker
tag of FFE0 and goes through FFEF. Immediately following the tag is
an unsigned short value with the segment size -- which can be up to
65533 bytes long (just shy of 64 KB).
More information here:
http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
http://www.jpeg.org/public/jfif.pdf
Following the APP markers (FFE0 to FFEF) is the actual data for the
JPG image including compression tables and other data necessary for
the decoding of the JPG file.
All that you need to be concerned with is the APP segments. The
first marker FFE0 is required, but the rest are optional, and you
just need to decide which ones to add to the JPG file created by
REALbasic.
This is part of what I had hopped to do but I also need to read the
data that indicates whether it is merely a Tag in the ColorSpace
EXIF field, (either sRGB (1) or Adobe RGB 1998 (65535) and then
embed the appropriate profile.
There doesn't appear to be a Color Profile tag in EXIF. Besides, you
have no idea if the color profile was used, discarded or converted to
another profile. The best you can do is give the option to add a
profile. I am not even sure if REALbasic will display the JPG with
profile correction.
Any sage advice, source code etc. would be welcome!
My source code is incomplete and I would have to start over again now
that I have a lot more experience... after all it was two years ago
that I started looking into the anatomy of a JPEG file.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>