ImageCollage

ImageCollage[{image1,image2,}]

creates a collage of images imagei.

ImageCollage[{w1image1,w2image2,}]

creates a collage of images imagei based on their corresponding weights wi.

ImageCollage[image1w1,image2w2,]

also creates a collage of images imagei based on their corresponding weights wi.

ImageCollage[{w1,w2,}{image1,image2,}]

also creates a collage of images imagei based on their corresponding weights wi.

ImageCollage[{{image1,w1},{image2,w2},}]

also creates a collage of images imagei based on their corresponding weights wi.

ImageCollage[,fitting]

uses the fitting method to create the collage.

ImageCollage[,fitting,size]

creates a collage of the specified size.

Details and Options

  • ImageCollage creates a collage of a list of images and can be used to create a compact visualization of photographs, graphics, etc.
  • ImageCollage[w->{image1,image2,}] assumes the same weight w for all imagei.
  • Weights wi can be either of one of the following forms:
  • wfinal area proportional to w
    Scaled[s]final area proportional to s multiplied by the original area
  • Possible values for fitting include:
  • "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
  • The following options can be specified:
  • Background GrayLevel[0.2]background color
    ImagePadding Nonepadding size to use around each image
    ImageSizeAutomaticdisplay size of the collage
    Method Automaticmethod to use for packing images
    Padding Automaticpadding scheme to use around each image
    Resampling Automaticresampling method
  • Possible settings for ImagePadding are:
  • Noneno padding
    mthe same padding on all sides
    {m,n}m pixels on left and right, n pixels on bottom and top
    {{left,right},{bottom,top}}different padding on different sides
  • Method can take one of the following settings:
  • "Rows"arrange in horizontal layers
    "Columns"arrange in vertical layers
    "Grid"a regular grid of images
    "ClosestPacking"closest packing from the top left

Examples

open allclose all

Basic Examples  (3)

Create an image collage from a list of images:

Create a collage from a weighted list of images:

Collage of flags of G7 countries, weighted by their population:

Scope  (4)

Weights  (2)

With no weights specified, almost-equal weights are assumed:

Images will appear to have roughly the same area:

Absolute weights represent a relationship between image areas in the collage:

Scaled weights get multiplied with original image dimensions:

Use Scaled[1] as the weight for all images to preserve original image area ratios:

Compatible Quantity objects can also be used as weights:

Fitting  (1)

Use different fitting schemes to specify how to fit images in the allocated space:

Size  (1)

If no size is specified, the collage size is influenced by the original dimensions as well as the method:

Specify the output image width:

Specify the width and height of the output image:

Create a portrait collage:

Options  (12)

Background  (4)

By default, the background is filled with GrayLevel[0.2]:

Specify a background color:

Use Background->Transparent to create a collage with transparent background:

With Padding->Automatic, images are padded with the background color:

Use a different padding value:

Method  (5)

By default, the packing method is automatically selected:

Specify the packing method:

The "ClosestPacking" method tries to find a packing while preserving relative weighted image areas:

The "Grid" method places the images in a regular grid:

The "Rows" method places images in horizontal layers:

Create vertical layers using Method->"Columns":

With Method->"Grid", by default all cells have the same size, equivalent to ItemSize->All:

Use ItemSize->Full to resize each grid cell to its full width and height:

ImagePadding  (1)

By default, images are not padded:

Specify the same padding size on all sides:

Specify different padding in the horizontal and vertical directions:

Specify different padding for each side:

Padding  (1)

By default, with Padding->Automatic, images are padded with the same color as Background:

Use a different Background:

Specify a different padding:

Resampling  (1)

By default, a suitable resampling method is chosen:

Specify the resampling method:

Applications  (5)

Create a collage where images are weighted by their median intensity:

Create a collage of thumbnails of all test images in ExampleData:

Create a collage of a collection of Picasso's notable paintings:

Get images as well as their corresponding areas for these paintings:

Collage of paintings where each is shown at a size proportional to its original area:

Collage of images of sample buildings, weighted by their number of floors:

Collage of multiple barcodes:

Recognize all barcodes in the collage:

Properties & Relations  (3)

ImageCollage works with all kinds of images:

ImageAssemble requires regular images:

Use ConformImages to preprocess the set:

Use Grid to visualize images in a regular grid:

Use WordCloud to assemble words in 2D layout:

Possible Issues  (1)

If the image set exhibits some regularity, the weights may be altered to create a more packed collage:

Explicitly set all weights to 1 to avoid area differences:

Neat Examples  (3)

Create a country population visualization by showing each country flag, weighted by its population:

Select countries that contribute to at least 0.2 percent of the world population:

Create the collage:

Make a collage of 20 disks of random color and size:

Nestedly apply ImageCollage:

Wolfram Research (2014), ImageCollage, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageCollage.html (updated 2015).

Text

Wolfram Research (2014), ImageCollage, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageCollage.html (updated 2015).

CMS

Wolfram Language. 2014. "ImageCollage." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/ImageCollage.html.

APA

Wolfram Language. (2014). ImageCollage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageCollage.html

BibTeX

@misc{reference.wolfram_2024_imagecollage, author="Wolfram Research", title="{ImageCollage}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/ImageCollage.html}", note=[Accessed: 02-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_imagecollage, organization={Wolfram Research}, title={ImageCollage}, year={2015}, url={https://reference.wolfram.com/language/ref/ImageCollage.html}, note=[Accessed: 02-November-2024 ]}