Geoscience Reference
In-Depth Information
The compression algorithms can be configured with extra creation options.
For the LZW and DEFLATE algorithms, you can set the predictor creation option
-co predictor=[1/2/3] . The default is 1 (no predictor), 2 is horizontal
differencing and 3 is floating point prediction. The floating point predictor should
only be used if your image has floating point data. For integer data types, a predictor 2
can improve the compression ratio for smoothly varying images. The creation option
-coZLEVEL=[1..9] controls compression rate as a trade off to computing (CPU)
time. Use ZLEVEL=1 for least and ZLEVEL=9 for maximumcompression. To get an
idea of some typical lossless compression ratio's, we compressed a Landsat 8 image
of 7,801 samples, 7,571 lines and twelve spectral bands. The compression rates for
different algorithms and configurations are shown in Fig. 5.1 . We also computed
some basic statistics on the images to get an idea of the access time. The stripped
version (no tiling) of the Landsat 8 image was taken as a reference (no compression:
rate equals to 1). Due to some overhead, the tiled image (no compression, tiled) is
slightly larger, resulting in a compression rate less than 1. The best compression
ratio is obtained for the tiled image, compressed with the DEFLATE algorithm and a
ZLEVEL of nine. Notice that in this case, also the CPU time to calculate basic image
statistics is relatively low, in spite of the more complicated compression algorithm.
It is important to mention here that these results should be used as just an indica-
tion. Actual figures will depend on the type of image and the relative speed of your
processor and file access.
Larger compression rates can be obtained with lossy compression at the expense
of quality loss. A typical lossy compression algorithm for gray scale and (RGB)
color images is JPEG. As an example, we create a false color quicklook image of
the Landsat 8 image. We use the bands 4, 3 and 2 to create the false color quicklook.
The data are automatically scaled to the range 0-255. An extra world file is created
that defines the coordinate reference system.
gdal_translate -b 4 -b 3 -b 2 -scale -ot Byte -of JPEG -co
WORLDFILE=YES -co QUALITY=50 LC82070232013160LGN00.tif
quicklook.jpg
The data type of the input image is UInt16, which is not supported by the JPEG
driver. We therefore scale the image from 0 to 255 (the default behavior of option
-scale ) and alter the output data type to Byte. It is georeferenced with an additional
World file, so we can still overlay it with other georeferenced vector and raster files.
This ASCII file (quicklook.wld) was originally introduced by ESRI and contains
the affine transformation coefficients location, scale and rotation but no coordinate
system. GDAL creates another ExtensibleMarkupLanguage (XML) file that contains
the projection information as well as metadata that was originally stored in the input
file.
 
 
Search WWH ::




Custom Search