Raster
✖
Raster
is a two-dimensional graphics primitive which represents a rectangular array of gray cells.
Details and Options

- Raster[array,ColorFunction->f] specifies that each cell should be colored using the graphics directives obtained by applying the function f to the value specified for that cell.
- If array has dimensions {n,m}, then Raster[array] is assumed to occupy the rectangle Rectangle[{0,0},{m,n}]. »
- Raster[array,{{xmin,ymin},{xmax,ymax}}] specifies that the raster should be taken instead to fill the rectangle Rectangle[{xmin,ymin},{xmax,ymax}]. »
- Scaled and Offset can be used to specify the coordinates for the rectangle.
- Raster[array,Automatic] is equivalent to Raster[array,{{0,0},{m,n}}].
- Raster[array,rect,{amin,amax}] specifies that cell values should be scaled so that amin corresponds to 0 and amax corresponds to 1. Cell values outside this range are clipped to be 0 or 1.
- array can be a SparseArray object.
- Image[Raster[…]] converts a Raster object to an image.
Examples
open allclose allBasic Examples (4)Summary of the most common use cases
Rectangular array of gray cells:

https://wolfram.com/xid/0mre0a-odd


https://wolfram.com/xid/0mre0a-uv5

Array of gray cells with opacity:

https://wolfram.com/xid/0mre0a-uey

Array of RGB cells with opacity:

https://wolfram.com/xid/0mre0a-t0v

Scope (14)Survey of the scope of standard use cases
Raster Specification (3)
For an ×
matrix, the raster occupies the rectangle {0,0} to {m,n}:

https://wolfram.com/xid/0mre0a-ki0ev

https://wolfram.com/xid/0mre0a-ml840t

Specify the shape of the raster explicitly, using ordinary coordinates:

https://wolfram.com/xid/0mre0a-e07yhs

Use Scaled and ImageScaled:

https://wolfram.com/xid/0mre0a-ef0hj0

https://wolfram.com/xid/0mre0a-bai9ay


https://wolfram.com/xid/0mre0a-bfb4yx

Use Offset:

https://wolfram.com/xid/0mre0a-cncaqi

https://wolfram.com/xid/0mre0a-ddt6u3

Raster Styling (11)
A raster of a scalar matrix uses gray level by default:

https://wolfram.com/xid/0mre0a-h4186

https://wolfram.com/xid/0mre0a-epfz9i


https://wolfram.com/xid/0mre0a-b8d4jz

The values outside the range 0 to 1 are normally clipped to be 0 or 1:

https://wolfram.com/xid/0mre0a-byhil7

https://wolfram.com/xid/0mre0a-d4c8vb


https://wolfram.com/xid/0mre0a-fvnuym

https://wolfram.com/xid/0mre0a-bqpkmb

The values outside the specified range are clipped:

https://wolfram.com/xid/0mre0a-hf9jkm

https://wolfram.com/xid/0mre0a-jagg8h

An array of pairs of numbers is treated as a gray level with opacity:

https://wolfram.com/xid/0mre0a-iqp2n2

https://wolfram.com/xid/0mre0a-mnvjmb

A raster of an array of triples uses RGB colors by default:

https://wolfram.com/xid/0mre0a-fhstel

https://wolfram.com/xid/0mre0a-ygihc


https://wolfram.com/xid/0mre0a-by32ea

An array of four numbers is treated as having RGB values with opacity:

https://wolfram.com/xid/0mre0a-vy9gw

https://wolfram.com/xid/0mre0a-z0lgh

Use Hue values for a scalar matrix:

https://wolfram.com/xid/0mre0a-c4ztm6

https://wolfram.com/xid/0mre0a-mlo810


https://wolfram.com/xid/0mre0a-b2klt5

https://wolfram.com/xid/0mre0a-jgkb09

Use a color function with the specified range:

https://wolfram.com/xid/0mre0a-b7wnck

https://wolfram.com/xid/0mre0a-cejbns


https://wolfram.com/xid/0mre0a-e401ks

https://wolfram.com/xid/0mre0a-npj143

Generalizations & Extensions (1)Generalized and extended use cases
Options (4)Common values & functionality for each option
ColorFunction (4)

https://wolfram.com/xid/0mre0a-bxi6y4

Color the raster cells using hue values:

https://wolfram.com/xid/0mre0a-eq624a

Use a user-defined color function:

https://wolfram.com/xid/0mre0a-c5liv9


https://wolfram.com/xid/0mre0a-kv9cx8

Applications (3)Sample problems that can be solved with this function

https://wolfram.com/xid/0mre0a-gmkm4d

https://wolfram.com/xid/0mre0a-34zee

Get a test RGB raster using ExampleData:

https://wolfram.com/xid/0mre0a-nkmxk6

https://wolfram.com/xid/0mre0a-gdnp9z


https://wolfram.com/xid/0mre0a-lnl2ol

https://wolfram.com/xid/0mre0a-dbzku1

Apply a filter using ListCorrelate, then display it:

https://wolfram.com/xid/0mre0a-3d5kb

https://wolfram.com/xid/0mre0a-fywts

https://wolfram.com/xid/0mre0a-glpsd3

Define a simple raster density plot function:

https://wolfram.com/xid/0mre0a-isqlpp

https://wolfram.com/xid/0mre0a-bhuacx

https://wolfram.com/xid/0mre0a-bthrh0


https://wolfram.com/xid/0mre0a-dom4na

Properties & Relations (7)Properties of the function, and connections to other functions
Rotate can be applied to a raster:

https://wolfram.com/xid/0mre0a-bsz45

Use ArrayPlot when visualizing discrete data:

https://wolfram.com/xid/0mre0a-hizsqm

https://wolfram.com/xid/0mre0a-v499c

Use ListDensityPlot when visualizing continuous data:

https://wolfram.com/xid/0mre0a-budjmk

https://wolfram.com/xid/0mre0a-d73yn3

Use ReliefPlot to visualize elevation data:

https://wolfram.com/xid/0mre0a-ojzwv

https://wolfram.com/xid/0mre0a-cm4g2

Rasterize can generate a raster graphic from any expression:

https://wolfram.com/xid/0mre0a-b8vmpn


https://wolfram.com/xid/0mre0a-dxd45u


https://wolfram.com/xid/0mre0a-yir4i


https://wolfram.com/xid/0mre0a-pjwq38


https://wolfram.com/xid/0mre0a-nmpdua


https://wolfram.com/xid/0mre0a-bi6ifd

ExampleData contains a number of test images:

https://wolfram.com/xid/0mre0a-xp3p4


https://wolfram.com/xid/0mre0a-g3lvo


https://wolfram.com/xid/0mre0a-hnc689

Many Import formats can produce Raster:

https://wolfram.com/xid/0mre0a-bscplv


https://wolfram.com/xid/0mre0a-esaq7u

Possible Issues (1)Common pitfalls and unexpected behavior
Wolfram Research (1991), Raster, Wolfram Language function, https://reference.wolfram.com/language/ref/Raster.html (updated 2010).
Text
Wolfram Research (1991), Raster, Wolfram Language function, https://reference.wolfram.com/language/ref/Raster.html (updated 2010).
Wolfram Research (1991), Raster, Wolfram Language function, https://reference.wolfram.com/language/ref/Raster.html (updated 2010).
CMS
Wolfram Language. 1991. "Raster." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/Raster.html.
Wolfram Language. 1991. "Raster." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/Raster.html.
APA
Wolfram Language. (1991). Raster. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Raster.html
Wolfram Language. (1991). Raster. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Raster.html
BibTeX
@misc{reference.wolfram_2025_raster, author="Wolfram Research", title="{Raster}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/Raster.html}", note=[Accessed: 23-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_raster, organization={Wolfram Research}, title={Raster}, year={2010}, url={https://reference.wolfram.com/language/ref/Raster.html}, note=[Accessed: 23-March-2025
]}