LinuxCommandLibrary

combine

Combine does not exist as a Linux command

TLDR

Output lines that are in both specified files

$ combine [path/to/file1] and [path/to/file2]
copy

Output lines that are in the first but not in the second file
$ combine [path/to/file1] not [path/to/file2]
copy

Output lines that in are in either of the specified files
$ combine [path/to/file1] or [path/to/file2]
copy

Output lines that are in exactly one of the specified files
$ combine [path/to/file1] xor [path/to/file2]
copy

SYNOPSIS

combine [options] input-image [{input-image}...] output-image

PARAMETERS

-help
    Print usage summary

-version
    Print ImageMagick version

-verbose
    Display detailed processing info

-debug
    Enable debug output (e.g., All, Cache)

-background
    Set background color (e.g., black)

-colorspace
    Output colorspace (e.g., sRGB, CMYK, XYZ)

-compress
    Compression method (e.g., JPEG, LZW, None)

-density
    Horizontal/vertical resolution (e.g., 72x72)

-depth
    Bits per pixel (e.g., 8, 16)

-quality
    Quality factor 1-100 for JPEG/PNG

-interlace
    Interlace scheme (e.g., Line, Plane)

-limit
    Resource limits (e.g., memory 256MiB)

DESCRIPTION

combine is a command-line tool from the ImageMagick suite for merging two or more input images into a single output image by stacking them as color channels. It excels at reconstructing full-color images from separated channel files, such as red, green, blue (RGB) or cyan, magenta, yellow, black (CMYK).

Usage is straightforward: list input images followed by the output file. The tool auto-detects combination mode based on input count:
• 1 image: Grayscale
• 2 images: Intensity + Alpha
• 3 images: RGB(A)
• 4 images: CMYK(A)
• More: Arbitrary channels.

Inputs should be same-sized and ideally grayscale; color inputs use luminance or specified channels. Specify output colorspace with -colorspace, e.g., sRGB, AdobeRGB, XYZ. Supports transparency via alpha/matte channels.

Inherits ImageMagick options for quality control, like compression, depth, and limits. Ideal for scientific imaging, graphics pipelines, or batch channel processing. Output format inferred from extension (PNG, TIFF, JPEG).

Requires ImageMagick installation; efficient for small-to-medium images.

CAVEATS

All inputs must have identical dimensions. Grayscale inputs ideal for channels; color inputs convert to intensity. Defaults to RGB for 3 inputs, CMYK for 4. Large images may consume high memory. Not for general image blending (use composite).

COMBINATION MODES

Auto-maps inputs to channels: 3 grayscale → RGB, 4 → CMYK, 5 → RGBA+Alpha, etc. Override with -colorspace.

EXAMPLES

combine red.png green.png blue.png result.png
combine -colorspace CMYK c.myp k.tif result.cmyk.tif
combine image.png mask.png -compose CopyOpacity result.png

HISTORY

Part of ImageMagick since version 5.5.2 (2003), developed by John Cristy starting 1991. Evolved for channel ops in v6.x; integrated into Magick++ API. Widely used in Linux distros via imagemagick package.

SEE ALSO

convert(1), composite(1), montage(1), identify(1), magick(1)

Copied to clipboard