OpenDX - Documentation
Full Contents QuickStart Guide User's Guide User's Reference
Previous Page Next Page Table of Contents Partial Table of Contents Index Search

QuantizeImage

Category

Transformation

Function

Converts an RGB image to a byte image with a colormap

Syntax

images = QuantizeImage(Images, nColors);

Inputs
Name Type Default Description
images image, image series (none) image(s) to quantize
nColors integer 256 maximum number of colors to use

Outputs
Name Type Description
images image, image series resulting quantized image(s)

Functional Details

QuantizeImage converts an image from a format in which the "colors" component is a list of RGB (red, green, blue) vectors, with as many entries as there are pixels in the image, to a format in which the "colors" component is simply a list of unsigned bytes which are interpreted as pointers into a color table.

QuantizeImage sets a "direct color map" attribute of 1 on its output. When the output images is passed to Display, this will force Display to use the colormap specified by QuantizeImage, rather than a default colormap (see "Using Direct Color Maps"). This will be the case even if you set the environment variable DX8BITCMAP to 1. You can use the Options module to set a "direct color map" attribute of 0 on the output of QuantizeImage to force Display to use a shared colormap.

images

is the image or series of images to be quantized.

nColors

is the maximum number of entries in the color table.

The output images will be a new image or series of images in which the color table is attached as a component called "color map".

The advantage of using QuantizeImage is that the image will consume much less memory.

Components

Changes the "colors" component. Adds a "color map" component.

Example Visual Programs

SIMPLE/QuantizeImage.net

See Also

Render, ReadImage, WriteImage, Display, Options


Full Contents QuickStart Guide User's Guide User's Reference

[ OpenDX Home at IBM | OpenDX.org ]