2

Currently, my app creates GeoTIFF tiled files using following options:

  • PROFILE=GeoTIFF
  • TILED=YES
  • BLOCKXSIZE=xxx
  • BLOCKYSIZE=xxx
  • COMPRESS=JPEG
  • PHOTOMETRIC=YCBCR
  • JPEG_QUALITY=xx

However, some apps that use my served tiles does not working due to "invalid" JFIF format.

How can I force GDAL to ensure JFIF format in GeoTIFF tiles?

4
  • Give more information. What is wrong, how should it be? Why it has not been a problem for other COG users? Forcing different encoding would probably require code changes in how libjpeg is used.
    – user30184
    Mar 22, 2022 at 9:17
  • Do you understand these considerations libtiff.maptools.org/TIFFTechNote2.html?
    – user30184
    Mar 22, 2022 at 9:32
  • @user30184 jpeg tiles are stored using baseline DCT-based JPEG marker (0xFF, 0xC0) instead using APPn marker (0xFF, 0xEn) described in Syntax and structure. My idea is force gdal to ensure JPEG-File structure using JFIF-APP0 (0xFF, 0xE0 ...) as File format structure
    – Tio Pepe
    Mar 28, 2022 at 8:38
  • 1
    It is absolutely best to introduce your idea on the gdal-dev mailing list. Explain the advantages and if you plan to change the current behavior or to introduce a new option. Consider also what it would mean for existing applications. If there are some apps that do not read current tiles, can there be some other apps that would not read the new variant? Could it be possible to make "some apps" to accept the current tiles? There must be enormous amounts of GeoTIFFs produced this way during the last 20 years.
    – user30184
    Mar 28, 2022 at 9:01

1 Answer 1

1

Gdal library code forces not writing JFIF-APP0 marks on any JPEG tiled image.

In gdal/frmts/gtiff/libtiff/tif_jpeg.c (line 1972), changing

sp->cinfo.c.write_JFIF_header = FALSE 

by

sp->cinfo.c.write_JFIF_header = TRUE

forces saving JFIF marks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.