pixscale — change the size of a color pix file
pixscale [-r ] [-s
will take a color
format file of given dimensions and produce a larger or smaller
flags specify the input file width and number of scan lines in pixels.
They can both be set to the same value via
flags specify the desired output file width and number of scan lines in
pixels. They can both be set to the same value via
Defaults of 512 are assumed for any unspecified dimensions.
The algorithm used is bilinear interpolation if scaling up, and a box filter of arbitrary size if scaling down. For the box filter a "square pixel" assumption is made; that is, all whole and fractional input pixels falling into a rectangle the size of an output pixel contribute equally according to the fraction of the output pixel area they cover. When interpolating, the edge pixels are preserved, i.e. all of the interpolated pixels fall inside of the edges. This can be a bit surprising when say doubling the size of a file as only the edge pixels will fall at exactly the location of an output pixel.
flag changes from bilinear interpolation to
nearest neighbor interpolation, i.e. it enlarges the image by
For 2X interpolation, a much faster alternative is pixinterp2x(1).
This program cannot scale up in one dimension and down in the other at the same time. The box filter used for scaling down results in the usual high-frequency ripple. Optional cubic interpolation would be nice.
This software is Copyright (c) 1989-2016 by the United States Government as represented by U.S. Army Research Laboratory.