On Jan 16, 2007, at 11:04 AM, realbasic-nug-
[EMAIL PROTECTED] wrote:
From looking at a handful of JPEG files in a hex editor, it appears
that the
first 10 bytes of every JPEG file is identical: ff d8 ff e0 00 10
4a 46 49
46. So you might consider opening each file, or each questionable file
perhaps, and reading the first 10 bytes of its binarystream to see
if it
matches that pattern.
As far as I know only the first two bytes define a JPEG file (FFD8).
The following bytes you are seeing is a APP0 Data Chunk, which may
not be included with a JPEG image.
What about if I create an application which writes files with the
same pattern?
Chances are the JPEG processor will just complain that it is a
corrupt JPEG, or it may crash.
I mean: is reading bytes of a file a reliable way to determine it's
contents?
Reading bytes I would say is the most reliable method for a JPEG
image. I have a ton of JPEGs that Windows has no clue (and neither
does the Mac when they come from Windows) because they do not have a
file extension.
I hope this helps.
p.s. I have written a function that determines the file type based
upon reading the file data, if you are interested then please let me
know.
Mahalo & Aloha,
Sam Rowlands
_______________________________________________
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>