RGBA32

Index:
ppm2rgba
rgba2ppm
rgbaadd
rgbaaddB
rgbaautocrop
rgbadither
rgbafade
rgbamerge
rgbamergeB
rgbaquant
rgbascale
rgbascaleB
rgbascaleF
rgbasub
rgbasubB
rgbatrans

trouble-
shooting

the RGBA32 manual and style guide:

rgbascale
rgbascaleB
rgbascaleF

Command line:

rgbascale [input_file] { scale | x_scale y_scale }
rgbascaleB [input_file] { scale | x_scale y_scale }
rgbascaleF [input_file] { scale | x_scale y_scale }

Usage:

Rgbascale, rgbascaleB and rgbascaleF are slight variations of the same utility. They can take input either from stdin or from a file specified on the command line. If a filename appears on the command line, stdin will not be checked for input. Filenames must appear before numeric arguments. Output is directed to stdout and errors to stderr.

Scaling may be specified by a single proportion argument that will scale both axes and preserve aspect ratio, or by independent x and y specifications. The values my be specified in terms of absolute pixel sizes (eg, "rgbascale 100 150" will produce a 100x150 image), or as a percentage of input size (eg, "rgbascale 33%" will scale the x and y axes to 33% of input size).

RgbascaleB specifies that the unweighted box algorithm will be used to scale the image. RgbascaleF uses a fourier transform to scale the image. Rgbascale will choose between the box transform and the fourier transform; if both axes are to be reduced, the box transform is used, else the fourier transform is used. The box transform is generally well behaved but can 'fuzz' an image slightly. The fourier transform is better at preserving sharpness of detail, but can 'ring' or 'ripple' slightly around thin, sharp features. A weighted box transform and normalized fourier transform will be added in the future to provide some advantages of both.

The most useful aspect of scaling is that it performs antialiasing; some of the resolution of a larger image can be preserved after reduction by averaging and weigting pixels with intermediate colors (examples below demonstrate this concept). Thus, small images that must avoid 'jaggies' can be produced as larger images that are then scaled to fit their final intended size. RGBA32 scaling is also smart enough to properly anti-alias images with transparent portions during scaling.

Examples:

Note that the images as shown in the browser are GIFs; the actual rgba output is converted to GIF such that the browser can display it. Warning; Web browsers running on less than a 16 bit display (less than 65K colors) will almost certainly substitute colors wildly and/or dither the below images. This will degrade the image quality considerably.

antialiasing
original image scaled 30% (not antialiased) scaled 30% (antialiased)

unweighted box / fourier scaling
original image rgbascaleB 50% rgbascaleF 50%

enlarge
original image rgbascale 200%

Bugs:

In the interest of simple command-line parsing, all arguments that begin with a digit, decimal point or unary minus are considered to be numeric arguments (not filenames). Therefore, the input file cannot begin with any of these else it would be mistakenly taken as the first numeric argument.


These pages are copyright (C) 1994-1997 Xiphophorus. All rights reserved.