[gdal-dev] gdalwarp color table copy issue
Aaron Sutula
Aaron.Sutula at noaa.gov
Thu Sep 4 10:42:43 EDT 2008
Hi List,
I am using gdalwarp (FWTools 2.0.6) to re-sample a gif+gfw image into a
higher resolution geoTiff.
The orginal gif has a color table that specifies 0: 255,255,255,0 as one
color:
$ gdalinfo radar_conus_0.gif
Driver: GIF/Graphics Interchange Format (.gif)
Files: radar_conus_0.gif
Size is 3400, 1600
Coordinate System is `'
Origin = (-127.629361176470582,50.415612019896201)
Pixel Size = (0.017971305190311,-0.017971305190311)
Corner Coordinates:
Upper Left (-127.6293612, 50.4156120)
Lower Left (-127.6293612, 21.6615237)
Upper Right ( -66.5269235, 50.4156120)
Lower Right ( -66.5269235, 21.6615237)
Center ( -97.0781424, 36.0385679)
Band 1 Block=3400x1 Type=Byte, ColorInterp=Palette
NoData Value=0
Metadata:
GIF_BACKGROUND=0
Color Table (RGB with 32 entries)
0: 255,255,255,0
1: 240,240,240,255
2: 238,238,238,255
...
I run gdalwarp as follows:
gdalwarp -tr 0.005 0.005 -srcnodata 10000000 -dstnodata 0 -s_srs
EPSG:4269 -t_srs EPSG:4269 -r cubicspline -co "TILED=YES"
radar_conus_0.gif radar_resampled.tif
The resulting tif color table specifies 0: 255,255,255,255:
$ /home/aaron.sutula/FWTools-2.0.6/bin_safe/gdalinfo radar_conus_0.tif
Driver: GTiff/GeoTIFF
Files: radar_conus_0.tif
Size is 12220, 5751
Coordinate System is:
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.2572221010042,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4269"]]
Origin = (-127.629361176470582,50.415612019896201)
Pixel Size = (0.005000000000000,-0.005000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left (-127.6293612, 50.4156120) (127d37'45.70"W, 50d24'56.20"N)
Lower Left (-127.6293612, 21.6606120) (127d37'45.70"W, 21d39'38.20"N)
Upper Right ( -66.5293612, 50.4156120) ( 66d31'45.70"W, 50d24'56.20"N)
Lower Right ( -66.5293612, 21.6606120) ( 66d31'45.70"W, 21d39'38.20"N)
Center ( -97.0793612, 36.0381120) ( 97d 4'45.70"W, 36d 2'17.20"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Palette
NoData Value=0
Color Table (RGB with 256 entries)
0: 255,255,255,255
1: 240,240,240,255
2: 238,238,238,255
...
I'd really like to keep color 0 with a completely transparent alpha
value. I don't understand why gdalwarp is changing it from 0 to 255.
I've played around with the -dstalpha option, but I don't quite
understand it and I get unexpected results; It generates a tif with two
bands, one greyscale and one alpha... Not what I need.
Any advice?
Thank you,
Aaron
More information about the gdal-dev
mailing list