I have an uncompressed GeoTIFF file (figure 1) with the following band information:
Image Structure Metadata:
INTERLEAVE=PIXEL
Band 1 Block=5000x1 Type=Byte, ColorInterp=Red
Band 2 Block=5000x1 Type=Byte, ColorInterp=Green
Band 3 Block=5000x1 Type=Byte, ColorInterp=Blue
Band 4 Block=5000x1 Type=Byte, ColorInterp=Undefined
Figure 1
I have compressed the file using the following set of parameters:
gdal_translate -of gtiff -co compress=jpeg -co jpeg_quality=85 -co tiled=yes -co photometric=rgb uncompressed.tif compressed.tif
This gives me a file with the following information:
Image Structure Metadata:
COMPRESSION=JPEG
INTERLEAVE=PIXEL
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
Band 4 Block=256x256 Type=Byte, ColorInterp=Undefined
Problem:
When I serve my compressed image through GeoServer 2.1.4 I get image in figure 2 instead of the image in figure 1, which is what I would like. My goal is to have GeoServer just display the first three bands as RGB and ignore the 4th band.
Figure 2
I have tried to style the raster layer in GeoServer using SLD by adding the following channel configuration, but it didn't help.
1
2
3
Why is my image server through GeoServer 2.1.4 looking the way it is and how do I configure GeoServer to display the image 'correctly'?
Answer
I don't know how GDAL handles JPEG compression on a four band raster, it does not make much sense to me, JPEG is meant to be used against RGB (three band) or gray (one band) images. When you gdal_translate it you can also shave off the fourth band with, I believe, -b 1 -b 2 -b 3
No comments:
Post a Comment