[Gdal-dev] Where'd all my colors go? (gdal_translate)

Ethan Alpert ealpert at digitalglobe.com
Thu Dec 2 18:57:27 EST 2004



So I just wanted to reduce the resolution of a NTF file I have by 50%.
Naively I just ran gdal_translate:

-bash-2.05b$ gdal_translate -outsize 50% 50%
02SEP19145640-M2AS-000001200012_01_P001.NTF
02SEP19145640-M2AS-000001200012_01_P001_50%.NTF

Unfortunately I'm now left with an image that has nearly no colors (all
black). Below are the outputs of gdalinfo (with metadata removed) Note
the color band information for each. What did I do wrong? I'm running
GDAL 1.2.5.

-bash-2.05b$ gdalinfo 02SEP19145640-M2AS-000001200012_01_P00150%.NTF
Driver: GTiff/GeoTIFF
Size is 1058, 5813
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.2572235629972,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-67.173611,4.405556)
Pixel Size = (0.00014388,-0.00014398)
Metadata:
[...snip...]
Corner Coordinates:
Upper Left  ( -67.1736111,   4.4055556) ( 67d10'25.00"W,  4d24'20.00"N)
Lower Left  ( -67.1736111,   3.5686111) ( 67d10'25.00"W,  3d34'7.00"N)
Upper Right ( -67.0213889,   4.4055556) ( 67d 1'17.00"W,  4d24'20.00"N)
Lower Right ( -67.0213889,   3.5686111) ( 67d 1'17.00"W,  3d34'7.00"N)
Center      ( -67.0975000,   3.9870833) ( 67d 5'51.00"W,  3d59'13.50"N)
Band 1 Block=1058x3 Type=UInt16, ColorInterp=Gray
Band 2 Block=1058x3 Type=UInt16, ColorInterp=Gray
Band 3 Block=1058x3 Type=UInt16, ColorInterp=Gray
Band 4 Block=1058x3 Type=UInt16, ColorInterp=Gray


-bash-2.05b$ gdalinfo 02SEP19145640-M2AS-000001200012_01_P001.NTF
Driver: NITF/National Imagery Transmission Format
Size is 2116, 11626
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9108"]],
    AXIS["Lat",NORTH],
    AXIS["Long",EAST],
    AUTHORITY["EPSG","4326"]]
Origin = (-67.173611,4.405556)
Pixel Size = (0.00007194,-0.00007199)
Metadata:
[..snip..]
Corner Coordinates:
Upper Left  ( -67.1736111,   4.4055556) ( 67d10'25.00"W,  4d24'20.00"N)
Lower Left  ( -67.1736111,   3.5686111) ( 67d10'25.00"W,  3d34'7.00"N)
Upper Right ( -67.0213889,   4.4055556) ( 67d 1'17.00"W,  4d24'20.00"N)
Lower Right ( -67.0213889,   3.5686111) ( 67d 1'17.00"W,  3d34'7.00"N)
Center      ( -67.0975000,   3.9870833) ( 67d 5'51.00"W,  3d59'13.50"N)
Band 1 Block=1024x1024 Type=UInt16, ColorInterp=Blue
Band 2 Block=1024x1024 Type=UInt16, ColorInterp=Green
Band 3 Block=1024x1024 Type=UInt16, ColorInterp=Red
Band 4 Block=1024x1024 Type=UInt16, ColorInterp=Undefined



More information about the Gdal-dev mailing list