IMCOMBINE

Purpose:

Combine two or more images into a single image.

Syntax:

IMCOMBINE(img1, img2, ..., imgN, direction, order, bg)

imgN

-

Two or more arrays, the input images.

direction

-

Optional. An integer, the combination direction.

0:

Combine horizontally (side-by-side, default).

1:

Combine vertically (stacked)..

order

-

Optional. An integer, the combination order.

0:

Combine left to right or bottom to top (default)..

1:

Combine right to left or top to bottom..

bg

-

Optional. An integer, a color index for the background color of unequal sized images.  Defaults to 15, WHITE..

Returns:

A single combined RGB image.

Example:

W1: readimage(gethome + "\data\kasha.jpg");scalesoff

W2: W1;turbo;setaspect(-1);scalesoff

W3: W1;paruline;setaspect(-1);scalesoff

W4: imcombine(W1, W2, W3);scalesoff

W5: imcombine(W1, W2, W3, 0, 1);scalesoff

 

Side-By-Side Image Combine

W1 loads a color JPEG image.

W2 sets the image shading to TURBO.

W3 sets the image shading to PARULINE.

W4 horizontally combines the 3 images into a single image.

W5 also horizontally combines the 3 images into a single image, except the images are ordered right to left.

Example:

W1: readimage(gethome + "\data\kasha.jpg");scalesoff

W2: W1;turbo;setaspect(-1);scalesoff

W3: W1;paruline;setaspect(-1);scalesoff

W4: imcombine(W1, W2, W3, 1, 0);scalesoff

W5: imcombine(W1, W2, W3, 1, 1);scalesoff

 

Stacked Image Combine

W1 loads a color JPEG image.

W2 sets the image shading to TURBO.

W3 sets the image shading to PARULINE.

W4 stacks the 3 images into a single image.

W5 also stacks the 3 images into a single image, except the images are ordered top to bottom.

Example:

W1: readimage(gethome + "\data\kasha.jpg");scales(0)

W2: readimage(gethome + "\data\kashadog.jpg");scales(0)

W3: imcombine(w1, w2);scales(0)

W4: imcombine(w1, w2, 0, 0, black);scales(0)

 

UnequalSized CombinedImages

 

W1 and W2 load two images of different sizes.

W3 combines the images horizontally. By default, the smaller image is  padded with white pixels.

W4 is the same as W3, except the smaller image is padded with black pixels.

Remarks:

IMCOMBINE combines two or more images into a single image. If direction is 0, the images are combined side-by-side. If direction is 1, the images are stacked vertically.

When combining images of different dimensions, smaller images are padded with the specified background color bg.

All input images are converted to RGB if necessary.

IMCOMBINE is particularly useful for creating side-by-side or stacked image comparisons.

See Also:

IMAGE24

IMFADE

IMHIST

READIMAGE

RGB2MONO

RGBIMAGE