|
楼主 |
发表于 2015-5-8 18:02:51
|
显示全部楼层
Section - [15] How do I recognize which file
format I have, and what do I do about it?
If you have an alleged JPEG file that your software won't read, it's likely to be some proprietary JPEG-
based format. You can tell what you have by inspecting the first few bytes of the file:
1. A JFIF-standard file will start with the four bytes (hex) FF D8 FF E0, followed by two variable b
ytes (often hex 00 10), followed by 'JFIF'.
2. If you see FF D8 FF at the start, but not the 'JFIF' marker, you probably have a not-quite-JFIF
JPEG file. Most JFIF software should read it without complaint. If you are using something that is
picky enough to complain about the lack of a JFIF marker, try another decoder. (Both very old JPEG
files and very new ones may lack JFIF markers --- the new SPIFF standard mentioned above doesn't
use a JFIF marker. So gripe to your software vendor if you find this to be the problem.)
3. A Macintosh PICT file, if JPEG-compressed, will have several hundred bytes of header (often 726
bytes, but not always) followed by JPEG data. Look for the 3-byte sequence (hex) FF D8 FF. The text
'hoto - JPEG' will usually appear shortly before this header, and 'AppleMark' or 'JFIF' will usually ap-
pear shortly after it. Strip off everything before the FF D8 FF and you will usually be able to decode the
file. (This will fail if the PICT image is divided into multiple "bands"; fortunately banded PICTs aren't
very common. A banded PICT contains multiple JPEG datastreams whose heights add up to the total
image height. These need to be stitched back together into one image. Bailey Brown has some simple
tools for this purpose on a Web page at http://www.isomedia.com/homes/bailey/photo-jpeg/photo-jpeg.html.)
4. If the file came from a Macintosh, it could also be a standard JFIF file with a MacBinary header
attached. In this case, the JFIF header will appear 128 bytes into the file. Get rid of the first 128 bytes
and you're set.
5. Anything else: it's a proprietary format, or not JPEG at all. If you are lucky, the file may consist o
f a header and a raw JPEG data stream.If you can identify the start of the JPEG data stream (look for
FF D8), try stripping off everything before that.
At least one release of HiJaak Pro writes JFIF files that claim to be revision 2.01. There is no such spec;
the latest JFIF revision is 1.02. It looks like HiJaak got the high and low bytes backwards. Unfortunately,
most JFIF readers will give up on encountering these files, because the JFIF spec defines a major version
number change to mean an incompatible format change. If there ever *were* a version 2.01, it would be so
numbered because current software could not read it and should not try. (One wonders if HiJaak has ever
heard of cross-testing with other people's software.) If you run into one of these misnumbered files, you
can fix it with a binary-file editor, by changing the twelfth byte of the file from 2 to 1. |
|