---
title: "ReliefImage"
language: "en"
type: "Symbol"
summary: "ReliefImage[array] generates a relief image of an array of height values."
keywords: 
- bas-relief
- cartography
- digital elevation data
- embossing
- GIS data
- mapping
- relief shading
- terrain
- diffuse reflection
- aspect-based shading
- shaded relief
- digital map
- DiffuseReflection
- AspectBasedShading
canonical_url: "https://reference.wolfram.com/language/ref/ReliefImage.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Color Processing"
    link: "https://reference.wolfram.com/language/guide/ColorProcessing.en.md"
  - 
    title: "Creating & Importing Images"
    link: "https://reference.wolfram.com/language/guide/CreatingAndImportingImages.en.md"
related_functions: 
  - 
    title: "Image"
    link: "https://reference.wolfram.com/language/ref/Image.en.md"
  - 
    title: "ReliefPlot"
    link: "https://reference.wolfram.com/language/ref/ReliefPlot.en.md"
  - 
    title: "Colorize"
    link: "https://reference.wolfram.com/language/ref/Colorize.en.md"
  - 
    title: "ImageEffect"
    link: "https://reference.wolfram.com/language/ref/ImageEffect.en.md"
  - 
    title: "ArrayPlot"
    link: "https://reference.wolfram.com/language/ref/ArrayPlot.en.md"
---
# ReliefImage

ReliefImage[array] generates a relief image of an array of height values.

## Details and Options

* ``ReliefImage`` always gives an 8-bit RGB image.

* ``ReliefImage`` can take the following options:

|                       |                |                                                |
| :-------------------- | :------------- | :--------------------------------------------- |
| ClippingStyle         | {Black, White} | how to draw clipped parts of the surface       |
| ColorFunction         | Automatic      | how to determine the color of surfaces         |
| ColorFunctionScaling  | True           | whether to scale arguments to ColorFunction    |
| ImageSize             | Automatic      | the default displayed size                     |
| LightingAngle         | Automatic      | effective angle of the simulated light source  |
| Method                | Automatic      | the method to use                              |
| PlotRange             | All            | the range of height values to include          |

* In ``ReliefImage[array]``, ``array`` must be a rectangular array, with each element a single real number representing a $z$ value.

* Possible settings for ``Method`` include ``"DiffuseReflection"`` and ``"AspectBasedShading"``.

* ``ReliefImage`` also works with arbitrary images.

---

## Examples (24)

### Basic Examples (3)

Use elevation data to display shaded terrain:

```wl
In[1]:= ReliefImage[Reverse@Import["http://exampledata.wolfram.com/hailey.dem.gz", "Data"]]

Out[1]= [image]
```

---

Relief shading of an image to enhance details:

```wl
In[1]:= ReliefImage[[image]]

Out[1]= [image]
```

---

Display density data with shading:

```wl
In[1]:= ReliefImage[Table[i + Sin[i ^ 2 + j ^ 2], {i, -4, 4, .03}, {j, -4, 4, .03}], ColorFunction -> "SunsetColors"]

Out[1]= [image]
```

### Scope (1)

Shadings with no color:

```wl
In[1]:= ReliefImage[Table[Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], ColorFunction -> None]

Out[1]= [image]
```

Use predefined gradients:

```wl
In[2]:= ReliefImage[Table[i + Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], ColorFunction -> "StarryNightColors"]

Out[2]= [image]
```

### Options (17)

#### ClippingStyle (3)

Clipped regions are not shown by default:

```wl
In[1]:= ReliefImage[Table[Im[Sec[(i + I j) ^ 2]], {i, -3, 3, .03}, {j, -3, 3, .03}], PlotRange -> Automatic]

Out[1]= [image]
```

---

Use pink to fill the clipped regions:

```wl
In[1]:= ReliefImage[Table[Im[Sec[(i + I j) ^ 2]], {i, -3, 3, .03}, {j, -3, 3, .03}], ClippingStyle -> Pink, PlotRange -> Automatic]

Out[1]= [image]
```

---

Use gray where the surface is clipped at the top and purple where it is clipped at the bottom:

```wl
In[1]:= ReliefImage[Table[Im[Sec[(i + I j) ^ 2]], {i, -3, 3, .03}, {j, -3, 3, .03}], ClippingStyle -> {Purple, Gray}, PlotRange -> Automatic]

Out[1]= [image]
```

#### ColorFunction (5)

Shadings with no color:

```wl
In[1]:= ReliefImage[Table[Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], ColorFunction -> None]

Out[1]= [image]
```

---

Color by scaled $z$ coordinate:

```wl
In[1]:= ReliefImage[Table[y + Sin[x ^ 2 + y ^ 2], {x, -4, 4, 0.05}, {y, -4, 4, 0.05}], ColorFunction -> Hue]

Out[1]= [image]
```

---

Specify gray-level intensity by scaled $z$ coordinate:

```wl
In[1]:= ReliefImage[Table[x + Sin[3x + y ^ 2], {x, -4, 4, 0.05}, {y, -4, 4, 0.05}], ColorFunction -> GrayLevel]

Out[1]= [image]
```

---

Named color gradients color in the $z$ direction:

```wl
In[1]:= ReliefImage[Table[x + Sin[3x + y ^ 2], {x, -4, 4, 0.05}, {y, -4, 4, 0.05}], ColorFunction -> "SunsetColors"]

Out[1]= [image]
```

---

Use brightness to correspond to the height or density of a function:

```wl
In[1]:= ReliefImage[Table[x + Sin[3x + y ^ 2], {x, -4, 4, 0.05}, {y, -4, 4, 0.05}], ColorFunction -> (Hue[2 / 5, 3 / 4, #]&)]

Out[1]= [image]
```

#### LightingAngle (4)

By default, the simulated lighting is placed at $\frac{3\pi }{4}$, or the top-left corner, with altitude $\frac{\pi }{4}$ :

```wl
In[1]:= ReliefImage[Table[Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], ColorFunction -> None]

Out[1]= [image]
```

---

Place the light source at 180°, or the left side:

```wl
In[1]:= ReliefImage[Table[Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], LightingAngle -> 180°, ColorFunction -> None]

Out[1]= [image]
```

---

Place the light source at 0°, or the right side of the map, with $\frac{\pi }{12}$ altitude:

```wl
In[1]:= ReliefImage[Table[Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], ColorFunction -> None, LightingAngle -> {0, Pi / 12}]

Out[1]= [image]
```

---

The result with no shading:

```wl
In[1]:= ReliefImage[Table[Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], LightingAngle -> None]

Out[1]= [image]
```

#### Method (2)

Normally, the ``"DiffuseReflection"`` method is used for shading:

```wl
In[1]:= ReliefImage[Table[Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], Method -> "DiffuseReflection", ColorFunction -> None]

Out[1]= [image]
```

---

Use the ``"AspectBasedShading"`` method:

```wl
In[1]:= ReliefImage[Table[Sin[i ^ 2 + j ^ 2], {i, -4, 4, .05}, {j, -4, 4, .05}], Method -> "AspectBasedShading", ColorFunction -> None]

Out[1]= [image]
```

#### PlotRange (3)

Normally, ``ReliefImage`` uses all points to compute the range:

```wl
In[1]:= ReliefImage[Table[Im[Sec[(i + I j) ^ 2]], {i, -3, 3, .02}, {j, -3, 3, .02}], PlotRange -> All]

Out[1]= [image]
```

---

Automatically compute the $z$ range and clip extreme portions of it:

```wl
In[1]:= ReliefImage[Table[Im[Sec[(i + I j) ^ 2]], {i, -3, 3, .02}, {j, -3, 3, .02}], PlotRange -> Automatic]

Out[1]= [image]
```

---

Specify the $z$ range to emphasize features:

```wl
In[1]:= ReliefImage[Table[Im[Sec[(i + I j) ^ 2]], {i, -3, 3, .02}, {j, -3, 3, .02}], PlotRange -> {-.1, .5}]

Out[1]= [image]
```

### Possible Issues (1)

Define two consecutive datasets:

```wl
In[1]:=
data1 = Table[Sin[10i j]Exp[-j], {i, -1, 1, .01}, {j, 0, 1, .005}];
data2 = Table[Sin[10i j]Exp[-j], {i, -1, 1, .01}, {j, 1, 2, .005}];
```

Due to $z$-value scaling, two results may not be consistent:

```wl
In[2]:= Row[{ReliefImage[data1], ReliefImage[data2]}]

Out[2]= [image]
```

By specifying the same plot range, two results become consistent with each other:

```wl
In[3]:= Row[{ReliefImage[data1, PlotRange -> {-1, 1}], ReliefImage[data2, PlotRange -> {-1, 1}]}]

Out[3]= [image]
```

### Neat Examples (2)

A sum of quotients of norms seen in relief:

```wl
In[1]:= Table[ReliefImage[Table[Evaluate[Sum[Product[Norm[{x, y} - RandomReal[{-3, 3}, {2}]], {i, j}] / Product[Norm[{x, y} - RandomReal[{-3, 3}, {2}]], {i, j}], {j, 1, 10}]], {x, -5, 5, .05}, {y, -5, 5, .05}], PlotRange -> Automatic, ColorFunction -> "Rainbow", ClippingStyle -> Darker[Red]], {3}]

Out[1]= {[image], [image], [image]}
```

---

Sample a sum of five sine waves in random directions:

```wl
In[1]:= Table[ReliefImage[Table[Evaluate[Sum[Sin[RandomReal[4, 2].{x, y}], {5}]], {x, 0, 10, .05}, {y, 0, 10, .05}], ColorFunction -> "DarkRainbow"], {3}]

Out[1]= {[image], [image], [image]}
```

## See Also

* [`Image`](https://reference.wolfram.com/language/ref/Image.en.md)
* [`ReliefPlot`](https://reference.wolfram.com/language/ref/ReliefPlot.en.md)
* [`Colorize`](https://reference.wolfram.com/language/ref/Colorize.en.md)
* [`ImageEffect`](https://reference.wolfram.com/language/ref/ImageEffect.en.md)
* [`ArrayPlot`](https://reference.wolfram.com/language/ref/ArrayPlot.en.md)

## Related Guides

* [Color Processing](https://reference.wolfram.com/language/guide/ColorProcessing.en.md)
* [Creating & Importing Images](https://reference.wolfram.com/language/guide/CreatingAndImportingImages.en.md)

## History

* [Introduced in 2010 (8.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn80.en.md)