logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

pkreclass - replace pixel values in raster image

Description

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

Example

pkreclass-iinput1.tif-ooutput.tif-c1-r0-c2-r0

       replace pixel values 1 and 2 with value 0

       pkreclass-ivector.shp-ooutput.shp-cFROM-rTO-nINFIELD

       replace FROM with TO in field INFIELD (of type string) in vector file vector.shp and write to new  vector
       output.shp

       for((i=0;i<256;++i));do if(($i<100));then echo "$i 1";else echo "$i 0";fi;done > code.txt; pkreclass-iinput1.tif-ooutput.tif--codecode.txt

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

       pkreclass-iinput1.tif-ooutput.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)

       same as previous but without temporary file

                                                 01 January 2025                                    pkreclass(1)

Name

       pkreclass - replace pixel values in raster image

Options

-ifilename, --inputfilename
              Input image

       -mmask, --maskmask
              Mask image(s)

       -msknodatavalue, --msknodatavalue
              Mask  value(s) where image has nodata.  Use one value for each mask, or multiple values for a sin‐
              gle mask.

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

       -codefilename, --codefilename
              Recode text file (2 columns: from to)

       -cclasses, --classclasses
              list of classes to reclass (in combination with reclass option)

       -rclasses, --reclassclasses
              list of recoded classes (in combination with class option)

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

       -ofilename, --outputfilename
              Output mask file

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

       -offormat, --oformatformat
              Output image format (see also gdal_translate(1)).

       -bband, --bandband
              band index(es) to replace (other bands are copied to output)

       -nname, --fnamename
              field name of the shape file to be replaced default: label

       -cooption, --cooption
              Creation option for output file.  Multiple options can be specified.

       -ddescription, --descriptiondescription
              Set image description

       -vlevel, --bandband
              Band index(es) to extract.  Leave empty to use all bands

       -vlevel, --verboselevel
              Verbose mode if > 0

Synopsis

pkreclass-iinput [ -cfrom-rto ] -ooutput [options]

See Also