[gdal-dev] TIF + TFW to GeoTIFF without decompression/recompression

Even Rouault even.rouault at spatialys.com
Mon Sep 20 02:28:26 PDT 2021


Andrea,

Le 20/09/2021 à 11:11, Andrea Giudiceandrea via gdal-dev a écrit :
> Hi devs,
> gdal_transalte has an "hidden" feature (not mentioned in the docs 
> [1]), introduced since GDAL 1.10 [2], which allows to convert .JPG + 
> .JPW raster layer to GeoTIFF without decompressing and recompressing 
> the raster image (a so called "lossless conversion of JPEG into 
> JPEG-in-TIFF" [3]).
>
> It seem to me the same is not possible if the source is a .TIF (e.g. a 
> JPEG-in-TIFF) + .TFW raster layer. In this case the image is always 
> decompressed and then recompressed if a compression method is 
> specified, thus adding another unnecessary lossy step.
>
> I think the decompression / recompression cycle should obviously not 
> be needed converting a TIFF file to a GeoTIFF file (unless image 
> manipulation options are specified) and gdal_transalte should just 
> copy the source TIF file and add the proper GeoTIFF metadata tags 
> taken from the TFW file and from the -a_srs parameter.
>
> Maybe is there any other "hidden" feature I haven't been able to find 
> yet?
No, this is not implemented.  As you mention below gdal_edit, you could 
likely do a small script (or an enhancement of gdal_edit that has a 
-worldfile {filename} option)) to call SetGeoTransform() with a 
geotransform computed from the worldfile content
>
> Best regards.
>
> Andrea Giudiceandrea
>
>
> [1] https://github.com/OSGeo/gdal/issues/4510
> [2] 
> https://github.com/OSGeo/gdal/commit/a77c726484d508f1ffff2b9f5a9a869313092687
> [3] 
> https://erouault.blogspot.com/2014/04/advanced-jpeg-in-tiff-uses-in-gdal.html
>
>
> Side notes:
>
> I know gdal_edit could also be used, but it cannot automatically take 
> the georeferencing parameters from the TFW file.
>
> It could also be possible to use the geotifcp cli tool from 
> libgeotiff, but it seems it (the one shipped by OSGeo4W) has some 
> issues handling JPEG-in-TIFF files (while it works well with other 
> compression formats): the "Warning, fractional scanline discarded." 
> and "JPEGLib: Application transferred too few scanlines." errors are 
> reported unsuccessfully trying to convert a JPEG-in-TIFF + TFW to a 
> GeoTIFF.
>
> Instead, the very old and almost nowhere to be found GeoTiffExamin gui 
> tool can just add the proper GeoTIFF metadata tags, taken from the TFW 
> file, to a TIFF file without modifying the raster image. Anyway the 
> gui tool cannot be used for batch conversion.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list