pkreclass(1)

NAME
pkreclass - replace pixel values in raster image

SYNOPSIS
\FCpkreclass\F[]
\FC-i\F[] input [ \FC-c\F[] from \FC-r\F[] to ] \FC-o\F[] output [options]

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

OPTIONS

\FC-i\F[] filename, \FC--input\F[] filename
    Input image

\FC-m\F[] mask, \FC--mask\F[] mask
    Mask image(s)

\FC-msknodata\F[] value, \FC--msknodata\F[] value
    Mask value(s) where image has nodata. Use one value for each mask, or multiple values for a single mask.

\FC-nodata\F[] value, \FC--nodata\F[] value
    nodata value to put in image if not valid (0)

\FC-code\F[] filename, \FC--code\F[] filename
    Recode text file (2 columns: from to)

\FC-c\F[] classes, \FC--class\F[] classes
    list of classes to reclass (in combination with reclass option)

\FC-r\F[] classes, \FC--reclass\F[] classes
    list of recoded classes (in combination with class option)

\FC-ct\F[] filename, \FC--ct\F[] filename
    color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid))

\FC-o\F[] filename, \FC--output\F[] filename
    Output mask file

\FC-ot\F[] type, \FC--otype\F[] 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-of\F[] format, \FC--oformat\F[] format
    Output image format (see also gdal_translate(1)).

\FC-b\F[] band, \FC--band\F[] band
    band index(es) to replace (other bands are copied to output)

\FC-n\F[] name, \FC--fname\F[] name
    field name of the shape file to be replaced default: label

\FC-co\F[] option, \FC--co\F[] option
    Creation option for output file. Multiple options can be specified.

\FC-d\F[] description, \FC--description\F[] description
    Set image description

\FC-v\F[] level, \FC--band\F[] band
    Band index(es) to extract. Leave empty to use all bands

\FC-v\F[] level, \FC--verbose\F[] level
    Verbose mode if > 0

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

replace pixel values 1 and 2 with value 0

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

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

\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[]

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[]

same as previous but without temporary file