Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

JPEG image compression FAQ, part 1/2
Section - [15] How do I recognize which file format I have, and what do I do about it?

( Part1 - Part2 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Counties ]


Top Document: JPEG image compression FAQ, part 1/2
Previous Document: [14] Why all the argument about file formats?
Next Document: [16] What other common compatibility problems are there?
See reader questions & answers on this topic! - Help others by sharing your knowledge

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 bytes (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 'Photo - JPEG'
    will usually appear shortly before this header, and 'AppleMark' or
    'JFIF' will usually appear 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 of 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.

User Contributions:

ds
Report this comment as inappropriate
Oct 28, 2014 @ 6:06 am
sdsfsdfsd fsdf sdfsd fsd fsd fsd fsdfsdf sdf sdfsd fsdf sd fafsd fsa f
David Avs
Report this comment as inappropriate
Oct 28, 2014 @ 5:17 pm
Progressive JPEG is supported by all modern browsers.

There are libraries and even online tools to automatically convert JPEG files from progressive to baseline and back. For example, Uploadcare uses URL commands to do that:

* JPEG - Progressive: 6fdab0d5-5a07-4b34-8a3a-f61727972745/-/format/jpeg/-/progressive/yes/
* Same JPEG, Baseline: 6fdab0d5-5a07-4b34-8a3a-f61727972745/-/format/jpeg/-/progressive/no/

Here is how it looks in action (when first loaded, you can see how each image starts appearing differently): jsbin.com/nigasotobu/3/

See more docs at Uploadcare website.

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: JPEG image compression FAQ, part 1/2
Previous Document: [14] Why all the argument about file formats?
Next Document: [16] What other common compatibility problems are there?

Part1 - Part2 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
jpeg-info@uunet.uu.net





Last Update March 27 2014 @ 02:11 PM