expand
Description
expand upsamples an 8-bit OMG1 (JHC_header) raster by an integer factor (-factor > 1), or decimates it when given a negative factor (-factor < -1). When upsampling, it supports either pixel replication (default) or two-pass separable bilinear interpolation (-interp), optionally preserving masked background pixels (-mask, default 255).
CLI Options & Usage
expand -in <infile> -out <outfile> -factor <n> [-interp] [-mask]
-in <infile>: Input 8-bitOMG1raster file.-out <outfile>: Output resampled 8-bitOMG1raster file.-factor <n>: Integer expansion factor (> 1multipliesxmaxandymaxbynand dividesdxanddybyn;< -1decimates dimensions by|n|).-interp: Linearly interpolates intermediate pixels first across rows and then down columns instead of replicating square pixel blocks.-mask: Excludes background pixels (255) from bilinear interpolation so edges do not bleed into no-data regions.
Algorithm
- Updates
JHC_headerdimensions (xmax *= factor,ymax *= factor,dx /= factor,dy /= factor). - Replication mode (default): Copies each source pixel
(i, j)into ann à nblock[i*n .. i*n+n-1, j*n .. j*n+n-1]. - Bilinear mode (
-interp): Places source pixels ati*n, j*n, linearly interpolates intermediate columns along each key rowj*n, and then linearly interpolates intermediate rows down every column0 .. new_xmax-1(honoring-maskif enabled).