Re: CALL for DISCUSSION: eXIf 20170115 -- length

John Bowler <[email protected]>
Newsgroups gmane.comp.graphics.png.general
Message-ID <CAP7U39_5=t-oNysR+Uf32uV2fVpnr6ickx9M18uRd60+W8C1HA@mail.gmail.com>
On Mon, Jan 16, 2017 at 10:04 PM, Willem van Schaik <[email protected]> wrote:
> and maybe we should add:
>
>    It will often end with 0xFFD9 (there could be a padding byte
>    0x00) which is the EXIF EOI (End of Image) marker, because
>    many EXIF profiles end with a thumbnail image.

So far as I know there is no reason for the thumbnail to be at the end
even though the CIPA document shows it there and there is no reason
for the thumbnail to be a JPEG stream.  Indeed if the main image is
uncompressed the thumbnail cannot be compressed while if the main
image is compressed an uncompressed thumbnail may be used.

See the discussion on page 24 of CIPA 2016.

Some professional cameras (maybe all of them) offer TIFF as an output
format.  Since those files are uncompressed conversion to PNG may be
attractive.  The conversion has to add the JPEG "Exif\0\0" tag to the
TIFF Exif information but that's relatively little cost (just 6 bytes)
compared to the likely gain of the compression of the main image.  In
those images the thumbnail could easily be anywhere; it has a fixed
size.

In any case a program which edits the image will probably reconstruct
or discard the thumbnail; digikam does this even if it doesn't edit
the image because it adds its own fields to the Exif metadata.  (Well,
actually, I looked at the code - it reads the chunk in with exiv2 then
writes it out using exiv2 which completely reconstructs it.)

So far as I can see it isn't possible to rely on anything apart from
the TIFF header being anywhere; it is necessary to read the IFDs and
follow the pointers (offsets) to the relevant data.

-- 
John Bowler <[email protected]>
+1 (541) 450-9885
PO BOX 3151
KERBY OR 97531-3151
USA

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.