4

I have an output from 3rd party program in TIFF format where gdalinfo gives the following information:

Driver: GTiff/GeoTIFF
Files: J:\ascend\Lufthavne - ImgRAW\S°nderborg\ortho\sonderborg_ortho_gsd13-0-2.tif
Size is 16384, 16384
Coordinate System is:
PROJCS["WGS 84 / UTM zone 32N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",9],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32632"]]
Origin = (543741.728819748040000,6094062.354004472500000)
Pixel Size = (0.126364000000002,-0.126364000000024)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  543741.729, 6094062.354) (  9d41' 1.18"E, 54d59'29.50"N)
Lower Left  (  543741.729, 6091992.006) (  9d41' 0.05"E, 54d58'22.53"N)
Upper Right (  545812.077, 6094062.354) (  9d42'57.66"E, 54d59'28.83"N)
Lower Right (  545812.077, 6091992.006) (  9d42'56.47"E, 54d58'21.86"N)
Center      (  544776.903, 6093027.180) (  9d41'58.84"E, 54d58'55.68"N)
Band 1 Block=16384x32 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=16384x32 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=16384x32 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=16384x32 Type=Byte, ColorInterp=Alpha

Then if I do:

C:\Python\WinPython-64bit-2.7.6.4-gdal\python-2.7.6.amd64>%GDAL%/gdal_translate -co PREDICTOR=2 -co COMPRESS=LZW "J:\ascend\Lufthavne - ImgRAW\Sønderborg\ortho\sonderborg_ortho_gsd13-0-2.tif" "J:\ascend\Lufthavne - ImgRAW\Sønderborg\ortho_compressed\sonderborg_ortho_gsd13-0-2.tif"

I get the following information:

Driver: GTiff/GeoTIFF
Files: J:\ascend\Lufthavne - ImgRAW\S°nderborg\ortho_compressed\sonderborg_ortho_gsd13-0-2.tif
Size is 16384, 16384
Coordinate System is:
PROJCS["WGS 84 / UTM zone 32N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",9],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32632"]]
Origin = (543741.728819748040000,6094062.354004472500000)
Pixel Size = (0.126364000000002,-0.126364000000024)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  543741.729, 6094062.354) (  9d41' 1.18"E, 54d59'29.50"N)
Lower Left  (  543741.729, 6091992.006) (  9d41' 0.05"E, 54d58'22.53"N)
Upper Right (  545812.077, 6094062.354) (  9d42'57.66"E, 54d59'28.83"N)
Lower Right (  545812.077, 6091992.006) (  9d42'56.47"E, 54d58'21.86"N)
Center      (  544776.903, 6093027.180) (  9d41'58.84"E, 54d58'55.68"N)
Band 1 Block=16384x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=16384x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=16384x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=16384x1 Type=Byte, ColorInterp=Alpha

Can someone explain the changes? File went from 500mb to 250mb and I am wondering if my changes to the file have any meaning in terms of loosing information or if there is applications that can't handle the changed GeoTIFF file based on the information given from gdalinfo.

Then I also tried the last little thing, knowing that JPEG is not a lossless compression:

C:\Python\WinPython-64bit-2.7.6.4-gdal\python-2.7.6.amd64>%GDAL%/gdal_translate -b 1 -b 2 -b 3 -co COMPRESS=JPEG -co JPEG_QUALITY=95 -co PHOTOMETRIC=YCBCR "J:\ascend\Lufthavne - ImgRAW\Sønderborg\ortho\sonderborg_ortho_gsd13-0-2.tif" "J:\ascend\Lufthavne - ImgRAW\Sønderborg\ortho_compressed_loosy\sonderborg_ortho_gsd13-0-2.tif"

Which gives a file with only 50mb.

Driver: GTiff/GeoTIFF
Files: J:\ascend\Lufthavne - ImgRAW\S°nderborg\ortho_compressed_loosy\sonderborg_ortho_gsd13-0-2.tif
Size is 16384, 16384
Coordinate System is:
PROJCS["WGS 84 / UTM zone 32N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",9],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32632"]]
Origin = (543741.728819748040000,6094062.354004472500000)
Pixel Size = (0.126364000000002,-0.126364000000024)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=YCbCr JPEG
  INTERLEAVE=PIXEL
  SOURCE_COLOR_SPACE=YCbCr
Corner Coordinates:
Upper Left  (  543741.729, 6094062.354) (  9d41' 1.18"E, 54d59'29.50"N)
Lower Left  (  543741.729, 6091992.006) (  9d41' 0.05"E, 54d58'22.53"N)
Upper Right (  545812.077, 6094062.354) (  9d42'57.66"E, 54d59'28.83"N)
Lower Right (  545812.077, 6091992.006) (  9d42'56.47"E, 54d58'21.86"N)
Center      (  544776.903, 6093027.180) (  9d41'58.84"E, 54d58'55.68"N)
Band 1 Block=16384x16 Type=Byte, ColorInterp=Red
Band 2 Block=16384x16 Type=Byte, ColorInterp=Green
Band 3 Block=16384x16 Type=Byte, ColorInterp=Blue

By inspecting manually, I really can't see any difference in colors in the images, but the last TIFF file is only 50mb in comparison to the original 500mb. Providing maps for really huge areas, the drop in data actually means a lot in terms of price of storing all this data, even though data is cheap.

What's the best arguments to justify to a data scientist or GIS guy, that the JPEG version is good enough?

  • 2
    You've chosen to use a predictor. LZW (and deflate) are lossless compressions so you haven't lost data; just because data is compressed doesn't always mean the file is smaller! I would say the original is compressed on an LZW algorithm but not very well and probably without a predictor. – Michael Stimson Nov 5 '14 at 22:05
  • So I should read up about what a predicter do since it reduces size by factor of 2. – Poul K. Sørensen Nov 5 '14 at 22:22
  • It can and might there is no guarantee that it would reduce other images by a factor of 2... it's impossible to predict the compressed size before you perform the compression. – Michael Stimson Nov 5 '14 at 22:47
  • The predictor value have an effect on the size of the compressed image and using value 2 could have made the difference. LZW can also be written in an otherwise loose way and your original may be such. Make a test with your image by using predictor 1 and 2 and see what is the difference. LZW is lossless anyway so quality is the same. This thread seems to handle something similar comments.gmane.org/gmane.comp.gis.gdal.devel/38725. About argumenting for jpeg, take some screen captures for gis guys showing the difference. For scientist you may need to compute some figures. – user30184 Nov 6 '14 at 5:35
  • To sort out the unknown compression of the original, you might convert an ASCII DEM file to tif yourself using GDAL with different compression methods. The resulting quality can be inspected cellwise, compared to the original. – AndreJ Nov 6 '14 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.