pktools  2.6.7
Processing Kernel for geospatial data
examples_pkcrop

Examples of pkcrop

Crop the input image to the given bounding box

pkcrop -i input.tif -ulx 100 -uly 1000 -lrx 600 -lry 100 -o output.tif

Crop the input image to the envelop of the given polygon and mask all pixels outside polygon as 0 (using gdal_rasterize)

pkcrop -i input.tif -e extent.shp -o output.tif
gdal_rasterize -i -burn 0 -l extent extent.shp output.tif

Extract bands 3,2,1 (starting from 0) in that order from multi-band raster image input.tif

pkcrop -i input.tif -b 3 -b 2 -b 1 -o output.tif

Scale raster floating point image fimage.tif with factor 100 and write as single byte image with the given colourtable (for auto scaling, see next example)

pkcrop -i fimage.tif -s 100 -ot Byte -o bimage.tif -ct colortable.txt

Automatically scale raster floating point image fimage.tif to [0:100] and write the output as a single byte image with the given colourtable

pkcrop -i fimage.tif -as 0 -as 100 -ot Byte -o bimage.tif -ct colortable.txt

Crop raster image large.tif to the bounding box of raster image small.tif and use the same pixel size.

pkcrop -i large.tif $(pkinfo -i small.tif -bb -dx -dy) -o output.tif