Skip to documentation
DocumentationAll documentsEnglish

PIXINTERP2X(1)

NAME

pixinterp2x - interpolate a color pix file to twice the original resolution

On this page

SYNOPSIS

pixinterp2x [-s _squarefilesize_] [-w _file_width_] [-n _file_height_] [-h | -?] [_infile.pix_] > _outfile.pix_

DESCRIPTION

pixinterp2x reads a pix(5) file and produces an image with twice as many pixels in each direction by performing a bilinear interpolation between the pixels of the input. The input may be given as a file argument or piped on standard input; the doubled image is written to standard output.

The interpolated scanlines fall exactly half way between the input lines, and the original input lines are preserved exactly. Rather than extrapolate beyond the edges of the image, the first row and column are duplicated (the left and bottom edges). This differs from the behavior of pixscale(1).

This is a very fast implementation of one special case of interpolation. The general tool for arbitrary rescaling is pixscale(1). Doubling the resolution adds no new image information, but can be useful when driving a display at its highest resolution, such as when photographing an image.

The default input dimensions are 512 by 512 pixels.

OPTIONS

-s squarefilesize

Set both the width and height of the input image to squarefilesize pixels.

-w file_width

Set the width (in pixels) of the scanlines in the input file. The default is 512.

-n file_height

Set the number of scanlines of input to be processed. The default is 512.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Double a 1024x768 image and view the result
pixinterp2x -w 1024 -n 768 render.pix | pix-fb -w 2048 -n 1536

Interpolates a 1024x768 rendering up to 2048x1536 and pipes it directly to the framebuffer with pix-fb(1) for inspection, without writing an intermediate file.

Example 2. Upscale a square image and save it
pixinterp2x -s 256 small.pix > large.pix

Reads a 256x256 pix(5) image and writes a smoothly interpolated 512x512 image.

SEE ALSO

brlcad(1), pixscale(1), pix-fb(1), pix(5)

BUGS

More memory is used than is strictly necessary.

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org