[gdal-dev] JPEG compressed GeoTIFF ignores Nodata

Marius Jigmond mariusjigmond at hotmail.com
Sat Jan 29 09:47:43 EST 2011


Hi Everyone,

I am having some trouble figuring out why adding JPEG compression to a
RGB GeoTIFF results in Nodata pixel triplets becoming data pixel
triplets. Is this expected behavior due to the noisy nature of JPEG
compression or to the fact that these are border Nodata triplets? I know
certain algorithms process the boundary between data and Nodata
differently.

I'm running GDAL 1.8.0 with internal libtiff. The command I issued was:
gdal_translate -co COMPRESS=JPEG -co TILED=YES -co JPEG_QUALITY=90 -co
PHOTOMETRIC=YCBCR s70rgb321.tif test.tif

In QGIS using the identify feature on the same triplets results in:
s70rgb321.tif:
Band 1: null(nodata)
Band 2: null(nodata)
Band 3: null(nodata)
test.tif:
Band 1: 1
Band 2: 1
Band 3: 3


gdalinfo s70rgb321.tif yields:
Driver: GTiff/GeoTIFF
Files: s70rgb321.tif
       s70rgb321.tif.ovr
Size is 32261, 30632
Coordinate System is:
PROJCS["Pulkovo_1942_58_Stereo70",
    GEOGCS["GCS_Pulkovo 1942(58)",
        DATUM["Pulkovo_1942_58",
            SPHEROID["Krassowsky_1940",6378245,298.3,
                AUTHORITY["EPSG","7024"]],
            AUTHORITY["EPSG","6179"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Oblique_Stereographic"],
    PARAMETER["latitude_of_origin",46],
    PARAMETER["central_meridian",25],
    PARAMETER["scale_factor",0.99975],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",500000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (27432.591760581413837,941642.761553813470528)
Pixel Size = (28.512429802339831,-28.512429802339831)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (   27432.592,  941642.762) ( 18d26'17.19"E, 49d47'26.40"N)
Lower Left  (   27432.592,   68250.012) ( 19d18' 9.44"E, 41d58' 4.57"N)
Upper Right (  947272.090,  941642.762) ( 31d12'45.10"E, 49d48'33.95"N)
Lower Right (  947272.090,   68250.012) ( 30d23'36.76"E, 41d58'59.57"N)
Center      (  487352.341,  504946.387) ( 24d50'11.61"E, 46d 2'39.82"N)
Band 1 Block=32261x1 Type=Byte, ColorInterp=Red
  NoData Value=0
  Overviews: 16131x15316, 8066x7658, 4033x3829, 2017x1915, 1009x958,
505x479, 253x240
  Metadata:
    LAYER_TYPE=athematic
Band 2 Block=32261x1 Type=Byte, ColorInterp=Green
  NoData Value=0
  Overviews: 16131x15316, 8066x7658, 4033x3829, 2017x1915, 1009x958,
505x479, 253x240
  Metadata:
    LAYER_TYPE=athematic
Band 3 Block=32261x1 Type=Byte, ColorInterp=Blue
  NoData Value=0
  Overviews: 16131x15316, 8066x7658, 4033x3829, 2017x1915, 1009x958,
505x479, 253x240
  Metadata:
    LAYER_TYPE=athematic

gdalinfo test.tif yields:
Driver: GTiff/GeoTIFF
Files: test.tif
Size is 32261, 30632
Coordinate System is:
PROJCS["Pulkovo_1942_58_Stereo70",
    GEOGCS["GCS_Pulkovo 1942(58)",
        DATUM["Pulkovo_1942_58",
            SPHEROID["Krassowsky 1940",6378245,298.2999999999998,
                AUTHORITY["EPSG","7024"]],
            AUTHORITY["EPSG","6179"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Oblique_Stereographic"],
    PARAMETER["latitude_of_origin",46],
    PARAMETER["central_meridian",25],
    PARAMETER["scale_factor",0.99975],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",500000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (27432.591760581413837,941642.761553813470528)
Pixel Size = (28.512429802339831,-28.512429802339831)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  SOURCE_COLOR_SPACE=YCbCr
  COMPRESSION=YCbCr JPEG
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (   27432.592,  941642.762) ( 18d26'17.19"E, 49d47'26.40"N)
Lower Left  (   27432.592,   68250.012) ( 19d18' 9.44"E, 41d58' 4.57"N)
Upper Right (  947272.090,  941642.762) ( 31d12'45.10"E, 49d48'33.95"N)
Lower Right (  947272.090,   68250.012) ( 30d23'36.76"E, 41d58'59.57"N)
Center      (  487352.341,  504946.387) ( 24d50'11.61"E, 46d 2'39.82"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
  NoData Value=0
  Metadata:
    LAYER_TYPE=athematic
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
  NoData Value=0
  Metadata:
    LAYER_TYPE=athematic
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
  NoData Value=0
  Metadata:
    LAYER_TYPE=athematic

Thanks for any insights you might have.

-marius



More information about the gdal-dev mailing list