I have 3 band images beloging to the Spacenet dataset which I'm trying to convert to jpeg. I get the following warning:
Warning 6: JPEG driver doesn't support data type UInt16. Only eight bit byte bands supported.
I then changed the ouput to png, but no matter what I do, gdal_translate outputs completely black images (checked with Gimp, it's all 0s). The geographic information seems to be extracted correctly.
gdalinfo provides the following info:
Driver: GTiff/GeoTIFF
Files: RGB-PanSharpen_AOI_2_Vegas_img1.tif
Size is 650, 650
Coordinate System is:
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"]]
Origin = (-115.307517599999997,36.128297699699999)
Pixel Size = (0.000002700000000,-0.000002700000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left (-115.3075176, 36.1282977) (115d18'27.06"W, 36d 7'41.87"N)
Lower Left (-115.3075176, 36.1265427) (115d18'27.06"W, 36d 7'35.55"N)
Upper Right (-115.3057626, 36.1282977) (115d18'20.75"W, 36d 7'41.87"N)
Lower Right (-115.3057626, 36.1265427) (115d18'20.75"W, 36d 7'35.55"N)
Center (-115.3066401, 36.1274202) (115d18'23.90"W, 36d 7'38.71"N)
Band 1 Block=650x2 Type=UInt16, ColorInterp=Gray
Band 2 Block=650x2 Type=UInt16, ColorInterp=Undefined
Band 3 Block=650x2 Type=UInt16, ColorInterp=Undefined
I've also tried with mogrify, but it doen's work either. In fact, it seems to get stuck.
I'm not sure whether I'm missing an intermediate step of some kind or there's something wrong with my file.
The image is here.
Best Answer
Convert 0 to NoData:
Find image stats:
Use band min/max values to scale (or you could calculate a stddev scale or perhaps
gdalinfo -hist etc...
to calculate a percentage stretch)Or to output a white background: