generates an image from an integer matrix m, using colors for positive integers and black for non-positive integers.


replaces intensity values in image with pseudocolor values.

Details and Options


open allclose all

Basic Examples  (3)

Colorize a grayscale image:

Colorize a label matrix returned from a segmentation:

Colorize a 3D label matrix:

Options  (7)

ColorFunction  (3)

Apply a color scheme to a map:

Colorize a grayscale image:

Keep the background black using ColorRules:

Use a pure function as the color function:

ColorRules  (3)

Specify a background color different than black:

Specify color replacement rules for all matrix values:

Specify a color for the largest component:

ImageSize  (1)

By default, ImageSize->Automatic is used:

Specify the image size:

Applications  (3)

Pseudocoloring of an elevation map:

Random coloring of a map:

Colorize segmented countries based on their area:

Possible Issues  (1)

All foreground pixels are colored the same in a binary image:

To highlight components using different colors, compute the connected components first:

Neat Examples  (2)

Random colors applied to connected components of a cellular automaton:

Running more steps of the cellular automaton:

Colorize components in a 3D cellular automaton:

Introduced in 2010
Updated in 2012