[gdal-dev] Question on 0th IFD offset when producing a JPEG-Compressed GeoTIFF (GDAL 1.11 vs 2.x)

Daniele Romagnoli daniele.romagnoli at geo-solutions.it
Wed Dec 14 06:01:51 PST 2016

Hi List,
I'm investigating on some GeoTIFF data being produced with GDAL 1.11.3.
Basically, when setting COMPRESS=JPEG, the generated GTIFF has the 0th IFD
offset set to some KB.

these are the first 16 bytes of a GeoTIFF being generated like that:
49 49 2A 00 88 44 00 00 *10* 00 00 01 03 00 01

49 49 is the endianness
00 2A is the magic number
00 00 44 88 is the offset of the 0th IFD = (17544 bytes)
Then there are several TAGs (baseline, extended and so on).
However, I think that any TIFF reader will jump to the 00 00 44 88 offset.
Moreover, the offset 00 00 00 08 (referring to the red bolded byte in my
previous sample) seems not referred by any other referencing IFD.

So it seems like that GeoTIFF has some useless bytes right after the first

I have then tried to use GDAL 2.2.1 and GDAL 2.1.0 and with that version I
see that the GeoTIFF being produced using same exact command is smaller and
the 0th IFD offset is 8 with these recent versions.
(This information is confirmed by AsTIFFTagViewer and TiffInfo too).

When activating CPL_DEBUG on all versions I see this output on GDAL
1.11.3/1.11.4 whilst I don't see it on GDAL 2.x

*GTiff: directory moved during flush in FlushDirectory()*

I have quickly checked some reference in the issue tracker but I was unable
to find anything, especially due to the fact that when searching for "IFD"
it returns hundreds of results related to "IFDefined" :-)

Do you have any feedback or comment on this?
Is it related to any bug in old code or some version update? (is a
different libtiff version somehow involved?)

Please, let me know.
Best Regards,

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax:      +39 0584 1660272




Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility  for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20161214/042ffb1b/attachment.html>

More information about the gdal-dev mailing list