resample, resize – resample a picture


resample [ –x size ] [ –y size ] [ file ]
resize [ –b ] [ –x size ] [ –y size ] [ file ]


Resample resamples its input image (default standard input) to a new size. The image is decimated or interpolated using a Kaiser window.
The size of the resampled image can be specified with the –x and –y options. An unadorned value sets the number of pixels of that dimension; a suffixed percent sign specifies a percentage. If only one of –x or –y is given, the other dimension is scaled to preserve the aspect ratio of the original image. Thus, –x50% will reduce the image to half its original dimension in both x and y.
Resize is similar, except it sacrifices image quality for speed. The –b option uses a bilinear filter to improve image quality.
The input should be a Plan 9 image as described in image(6), and the output will be a compressed 24–bit r8g8b8 image. To uncompress the image or change the pixel format, use iconv (see crop(1)).




crop(1), image(6)


Resize is quick, but resample produces correct pictures.