---
title: "ImageAssemble"
language: "en"
type: "Symbol"
summary: "ImageAssemble[{{im11, ..., im 1 n}, ..., {im m1, ..., immn}}] assembles a single image from an array of images. ImageAssemble[{{im11, ..., im 1 n}, ..., {im m1, ..., immn}}, fitting] assembles images using the fitting method."
keywords: 
- image assemble
- combine images
- composite image
- partition image
- image grid
- image flatten
- montage
- subimage
canonical_url: "https://reference.wolfram.com/language/ref/ImageAssemble.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Image Composition"
    link: "https://reference.wolfram.com/language/guide/ImageComposition.en.md"
  - 
    title: "Basic Image Manipulation"
    link: "https://reference.wolfram.com/language/guide/BasicImageManipulation.en.md"
  - 
    title: "Image Processing & Analysis"
    link: "https://reference.wolfram.com/language/guide/ImageProcessing.en.md"
  - 
    title: "Image Computation: Update History"
    link: "https://reference.wolfram.com/language/guide/ImageComputation-UpdateHistory.en.md"
  - 
    title: "Data Visualization"
    link: "https://reference.wolfram.com/language/guide/DataVisualization.en.md"
  - 
    title: "Geometric Operations"
    link: "https://reference.wolfram.com/language/guide/ImageGeometry.en.md"
related_workflows: 
  - 
    title: "Combine Multiple Images"
    link: "https://reference.wolfram.com/language/workflow/CombineMultipleImages.en.md"
related_functions: 
  - 
    title: "ImageCollage"
    link: "https://reference.wolfram.com/language/ref/ImageCollage.en.md"
  - 
    title: "GridVideo"
    link: "https://reference.wolfram.com/language/ref/GridVideo.en.md"
  - 
    title: "GraphicsGrid"
    link: "https://reference.wolfram.com/language/ref/GraphicsGrid.en.md"
  - 
    title: "ArrayFlatten"
    link: "https://reference.wolfram.com/language/ref/ArrayFlatten.en.md"
  - 
    title: "ImageCompose"
    link: "https://reference.wolfram.com/language/ref/ImageCompose.en.md"
  - 
    title: "ImagePartition"
    link: "https://reference.wolfram.com/language/ref/ImagePartition.en.md"
---
# ImageAssemble

ImageAssemble[{{im11, …, im1n}, …, {imm1, …, immn}}] assembles a single image from an array of images.

ImageAssemble[{{im11, …, im1n}, …, {imm1, …, immn}}, fitting] assembles images using the fitting method.

## Details and Options

* ``ImageAssemble`` creates a collage from an array images, which can be used to compare the effects of one or two parameters on an image, or to visualize different steps of a procedure.

[image]

* ``ImageAssemble`` assembles an array of 2D or 3D images into a single image.

* ``ImageAssemble[{image1, image2, …}] `` assembles the ``imagei`` as a row.

* By default, using no fitting specification, the ``imageij`` should have commensurate sizes.

* Possible settings for ``fitting`` include:

|           |                                                               |
| --------- | ------------------------------------------------------------- |
| None      | do not attempt to match the dimensions                        |
| "Fill"    | fit the smaller dimension; crop the other if necessary        |
| "Fit"     | fit the whole image; keep the aspect ratio; pad if necessary  |
| "Stretch" | stretch the image to fit by resampling                        |

* If any ``imageij`` is ``Missing[]``, corresponding pixels are replaced with the background color.

* The following options can be specified:

|              |           |                                     |
| ------------ | --------- | ----------------------------------- |
| Background   | Automatic | background color to use             |
| PaddingSize  | 0         | padding size around the whole image |
| Resampling   | Automatic | resampling method to use            |
| Spacings     | 0         | spacing between images              |

* Settings for ``Spacings`` can have the following forms:

|                   |                                             |
| :---------------- | :------------------------------------------ |
| spec              | apply spec to all gaps between images       |
| {specx, specy, …} | applies specific spacing for each dimension |

---

## Examples (31)

### Basic Examples (2)

Assemble a 2D array of images:

```wl
In[1]:=
ImageAssemble[{
	{[image], [image], [image], [image], [image], [image], [image]}, {[image], [image], [image], [image], [image], [image], [image]}, {[image], [image], [image], [image], [image], [image], [image]}, {[image], [image], [image], [image], [image], [image], [image]}, {[image], [image], [image], [image], [image], [image], [image]}}]

Out[1]= [image]
```

---

Show the result of edge detection using varying radius and threshold values:

```wl
In[1]:= ImageAssemble[Table[EdgeDetect[[image], r, t], {r, {2, 4, 6}}, {t, {.01, .05, .1}}], Background -> 1, Spacings -> 5]

Out[1]= [image]
```

### Scope (11)

#### Data (7)

Assemble a row of images:

```wl
In[1]:= ImageAssemble[{[image], [image]}]

Out[1]= [image]
```

---

Assemble a column of images:

```wl
In[1]:=
ImageAssemble[(⁠|         |
| ------- |
| [image] |
| [image] |⁠)]

Out[1]= [image]
```

---

Assemble an array of images:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠)]

Out[1]= [image]
```

---

Assemble images of different types and color spaces:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠)]

Out[1]= [image]
```

---

The data may contain missing elements:

```wl
In[1]:=
ImageAssemble[(⁠|         |           |
| ------- | --------- |
| [image] | [image]   |
| [image] | Missing[] |⁠)]

Out[1]= [image]
```

---

The rows and columns with only ``Missing`` elements are skipped:

```wl
In[1]:=
ImageAssemble[(⁠|           |           |           |
| --------- | --------- | --------- |
| [image]   | [image]   | Missing[] |
| Missing[] | Missing[] | Missing[] |
| [image]   | [image]   | Missing[] |⁠)]

Out[1]= [image]
```

---

Assemble a list of 3D images:

```wl
In[1]:= ImageAssemble[{[image], [image], [image]}]

Out[1]= [image]
```

#### Fitting (4)

Assemble images of commensurate sizes:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠)]

Out[1]= [image]
```

---

Assemble images of different sizes fitting the larger dimension:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), "Fill"]

Out[1]= [image]
```

---

Assemble images of different sizes fitting the smaller dimension:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), "Fit"]

Out[1]= [image]
```

---

Assemble images of different sizes by resizing them:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), "Stretch"]

Out[1]= [image]
```

### Options (9)

#### Background (2)

The value of ``Background`` is used for whole-image padding as well as spacing. By default, 0 is used:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), PaddingSize -> 5, Spacings -> 5]

Out[1]= [image]
```

Specify the background color:

```wl
In[2]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), PaddingSize -> 5, Spacings -> 5, Background -> Red]

Out[2]= [image]
```

---

Setting ``Background`` to ``Transparent`` will result in an image with an alpha channel:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), PaddingSize -> 5, Spacings -> 5, Background -> Transparent]

Out[1]= [image]

In[2]:= Information[%, "Transparency"]

Out[2]= True
```

#### PaddingSize (2)

By default, the whole image is not padded:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠)]

Out[1]= [image]
```

Use ``PaddingSize`` to pad the whole image:

```wl
In[2]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), PaddingSize -> 5]

Out[2]= [image]
```

Use ``Background`` to specify the padding scheme:

```wl
In[3]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), PaddingSize -> 5, Background -> Red]

Out[3]= [image]
```

---

Specify a different padding size for each side in the form ``{{left, right}, {bottom, top}}`` :

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), PaddingSize -> {{2, 4}, {6, 8}}]

Out[1]= [image]
```

#### Spacings (5)

By default, no spacing is added between images:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠)]

Out[1]= [image]
```

---

Specify the amount of spacings:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), Spacings -> 5]

Out[1]= [image]
```

---

Specify different spacings in $x$ and $y$ directions:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), Spacings -> {10, 5}]

Out[1]= [image]
```

---

The value of ``Background`` specifies the color of spacings between images:

```wl
In[1]:=
ImageAssemble[(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), Spacings -> 5, Background -> Red]

Out[1]= [image]
```

---

Specify spacings in three dimensions for arrays of rank 3:

```wl
In[1]:=
ImageAssemble[{(⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠), (⁠|         |         |
| ------- | ------- |
| [image] | [image] |
| [image] | [image] |⁠)}, Spacings -> 3]

Out[1]= [image]
```

### Applications (7)

Search the web for some images:

```wl
In[1]:= list = WebImageSearch["fish", "Thumbnails", MaxItems -> 4]

Out[1]= [image]
```

Assemble images by cropping them to commensurate sizes:

```wl
In[2]:= ImageAssemble[Partition[list, 2], "Fill", Spacings -> 5, Background -> White]

Out[2]= [image]
```

---

Assemble different steps of fractal sets:

```wl
In[1]:=
ImageAssemble[
	Table[Rasterize[mesh[i], RasterSize -> 100], {mesh, {SierpinskiMesh, MengerMesh}}, {i, 4}], 
	Spacings -> 3, PaddingSize -> 3, Background -> Gray]

Out[1]= [image]
```

---

Assemble a collection of Delacroix's artworks:

```wl
In[1]:=
paintings = EntityValue[Entity["Person", "EugeneDelacroix::77vj8"], EntityProperty["Person", "NotableArtworks"]];
data = DeleteMissing[EntityValue[paintings, "Image"]];
ImageAssemble[Partition[data, 5], "Fill", Spacings -> 3, PaddingSize -> 3, Background -> White]

Out[1]= [image]
```

---

Assemble images smoothly by assembling at different scales using image pyramids:

```wl
In[1]:= {apple, orange} = {[image], [image]};

In[2]:=
splitMerge[i1_Image, i2_Image] := 
	 With[{c = Floor[1 / 2 First@ImageDimensions[i1]]}, 
	ImageAssemble[{{ImageTake[i1, All, {1, c}], ImageTake[i2, All, {c + 1, -1}]}}]]
```

Create image pyramids:

```wl
In[3]:= pyramids = Map[ImagePyramid[#, "Laplacian", {2, 2}]&, {apple, orange}];
```

Merge at all scales:

```wl
In[4]:= pFruit = ImagePyramidApply[splitMerge, pyramids]

Out[4]= ImagePyramid[<|ImageDimensions -> {{296, 298}, {148, 149}, {74, 75}, {37, 37}, {19, 19}, {9, 9}, {5, 5}, {2, 2}}, LevelCount -> 8, Levels -> {-Image-, -Image-, -Image-, -Image-, -Image-, -Image-, -Image-, -Image-}, LowpassKernel -> Gaussian, HighpassKernel -> Automatic, Padding -> Reversed, KernelSampling -> Linear, ScalingFactor -> 2, Type -> Laplacian|>]
```

Reconstruct the image:

```wl
In[5]:= InverseImagePyramid[pFruit]

Out[5]= [image]
```

Compare with the single scale assembly:

```wl
In[6]:= splitMerge[apple, orange]

Out[6]= [image]
```

---

Assemble together different effects applied to an image:

```wl
In[1]:= effects = {"Decolorization", "Comics", "Sepia", "Embossing", "ColorBoosting", "EdgeStylization", "Jitter", "OilPainting"};

In[2]:= i = [image];ImageAssemble[ArrayReshape[ImageEffect[i, #]& /@ effects, {2, 4}], Spacings -> 2]

Out[2]= [image]
```

---

Explore the effect of an increasing filter radius on successive slices of an image:

```wl
In[1]:=
i = [image];
ImageAssemble[MapIndexed[Blur[#1, 2Last[#2]]&, ImagePartition[i, Scaled[{1 / 6, 1}]], {2}], Spacings -> 1]

Out[1]= [image]
```

---

Detect and highlight object in frames from a video:

```wl
In[1]:= v = Video[CloudObject["https://www.wolframcloud.com/obj/documentation/dog"]]

Out[1]= \!\(\*VideoBox["![Embedded Video Player](video://content-a882q)"]\)

 DynamicModule[«3»]

In[2]:= list = VideoFrameList[v, 100];

In[3]:= RandomSample[list, 3]

Out[3]= [image]
```

Check which frame contains a dog:

```wl
In[4]:= check = ImageContainsQ[#, Entity["Concept", "CanisFamiliaris::597qc"]]& /@ list;
```

Create a visualization of which frames contain a dog:

```wl
In[5]:= ImageAssemble[Partition[MapThread[ImageAdd[ImageResize[#, 50], #2 {0, .4, 0}]&, {list, Boole[check]}], 10], Spacings -> 1]

Out[5]= [image]
```

### Properties & Relations (2)

``ImageAssemble`` and ``ImagePartition`` are reverse operations:

```wl
In[1]:=
i = RandomImage[1, {10, 10}];
i == ImageAssemble[ImagePartition[i, 5]]

Out[1]= True
```

---

By default, ``ImageAssemble`` requires images to have commensurate sizes:

```wl
In[1]:= list = {[image], [image], [image]};

In[2]:= ImageAssemble[list]
```

ImageAssemble::row: Expecting images of the same height in one row.

```wl
Out[2]= ImageAssemble[{[image], [image], [image]}]
```

Use the ``fitting`` argument to preprocess the set:

```wl
In[3]:= ImageAssemble[list, "Fit"]

Out[3]= [image]
```

Use ``ConformImages`` to perform custom fitting:

```wl
In[4]:= ImageAssemble[ConformImages[list, 100, "Pad"]]

Out[4]= [image]
```

## See Also

* [`ImageCollage`](https://reference.wolfram.com/language/ref/ImageCollage.en.md)
* [`GridVideo`](https://reference.wolfram.com/language/ref/GridVideo.en.md)
* [`GraphicsGrid`](https://reference.wolfram.com/language/ref/GraphicsGrid.en.md)
* [`ArrayFlatten`](https://reference.wolfram.com/language/ref/ArrayFlatten.en.md)
* [`ImageCompose`](https://reference.wolfram.com/language/ref/ImageCompose.en.md)
* [`ImagePartition`](https://reference.wolfram.com/language/ref/ImagePartition.en.md)

## Related Guides

* [Image Composition](https://reference.wolfram.com/language/guide/ImageComposition.en.md)
* [Basic Image Manipulation](https://reference.wolfram.com/language/guide/BasicImageManipulation.en.md)
* [Image Processing & Analysis](https://reference.wolfram.com/language/guide/ImageProcessing.en.md)
* [Image Computation: Update History](https://reference.wolfram.com/language/guide/ImageComputation-UpdateHistory.en.md)
* [Data Visualization](https://reference.wolfram.com/language/guide/DataVisualization.en.md)
* [Geometric Operations](https://reference.wolfram.com/language/guide/ImageGeometry.en.md)

## Related Workflows

* [Combine Multiple Images](https://reference.wolfram.com/language/workflow/CombineMultipleImages.en.md)

## History

* [Introduced in 2008 (7.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn70.en.md) \| [Updated in 2012 (9.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn90.en.md) ▪ [2020 (12.1)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn121.en.md)