Reference

pkreclass(1)

replace pixel values in raster image

NAME

pkreclass - replace pixel values in raster image

SYNOPSIS

FCpkreclassF[0] FC-iF[0] input [ FC-cF[0] from FC-rF[0] to ] FC-oF[0] output [options]

DESCRIPTION

pkreclass is a program to replace pixel values in raster images.

OPTIONS

FC-iF[0] filename, FC--inputF[0] filename

Input image

FC-mF[0] mask, FC--maskF[0] mask

Mask image(s)

FC-msknodataF[0] value, FC--msknodataF[0] value

Mask value(s) where image has nodata. Use one value for each mask, or multiple values for a single mask.

FC-nodataF[0] value, FC--nodataF[0] value

nodata value to put in image if not valid (0)

FC-codeF[0] filename, FC--codeF[0] filename

Recode text file (2 columns: from to)

FC-cF[0] classes, FC--classF[0] classes

list of classes to reclass (in combination with reclass option)

FC-rF[0] classes, FC--reclassF[0] classes

list of recoded classes (in combination with class option)

FC-ctF[0] filename, FC--ctF[0] filename

color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid))

FC-oF[0] filename, FC--outputF[0] filename

Output mask file

FC-otF[0] type, FC--otypeF[0] type

Data type for output image ({Byte / Int16 / UInt16 / UInt32 / Int32 / Float32 / Float64 / CInt16 / CInt32 / CFloat32 / CFloat64}). Empty string: inherit type from input image

FC-ofF[0] format, FC--oformatF[0] format

Output image format (see also gdal_translate(1)).

FC-bF[0] band, FC--bandF[0] band

band index(es) to replace (other bands are copied to output)

FC-nF[0] name, FC--fnameF[0] name

field name of the shape file to be replaced default: label

FC-coF[0] option, FC--coF[0] option

Creation option for output file. Multiple options can be specified.

FC-dF[0] description, FC--descriptionF[0] description

Set image description

FC-vF[0] level, FC--bandF[0] band

Band index(es) to extract. Leave empty to use all bands

FC-vF[0] level, FC--verboseF[0] level

Verbose mode if > 0

EXAMPLE

FC
pkreclass -i input1.tif -o output.tif -c 1 -r 0 -c 2 -r 0
      F[0]

replace pixel values 1 and 2 with value 0

FC
pkreclass -i vector.shp -o output.shp -c FROM -r TO -n INFIELD
      F[0]

replace FROM with TO in field INFIELD (of type string) in vector file FCvector.shpF[0] and write to new vector FCoutput.shpF[0]

FC
for((i=0;i<256;++i));do if(($i<100));then echo "$i 1";else echo "$i 0";fi;done > code.txt; pkreclass -i input1.tif -o output.tif --code code.txt
      F[0]

replace all values smaller than 100 with 1, all other values with 0

FC
pkreclass -i input1.tif -o output.tif $(for((i=0;i<256;++i));do if(($i<100));then echo -n " -c $i " " -r 1";else echo " -c $i " " -r 0";fi;done)
      F[0]

same as previous but without temporary file

History