How to compare images side by side as a montage with ImageMagick

This page describes the procedure for comparing images side by side by creating a montage with ImageMagick.

What is MONTAGE in ImageMagick?

MONTAGE is a utility, that is a part of ImageMagick. It can arrange images side by side and save it as a single composite image. This is used for comparing the colors or quality of cameras, filters, editing, post processing and image technology.

$ man montage
NAME
montage - create a composite image by combining several separate
images. The images are tiled on the composite image optionally adorned
with a border, frame, image name, and more.
SYNOPSIS
magick montage input-file[s] [options] output-file
OVERVIEW
The montage program is a member of the ImageMagick(1) suite of tools.
Use it to create a composite image by combining several separate
images. The images are tiled on the composite image optionally adorned
with a border, frame, image name, and more.

Create a montage with MONTAGE in ImageMagick

In this example, several images are given as input to MONTAGE. Each images is automatically rotated according to EXIF data, resized and cropped to 1:1 aspect ratio, annotated with the filename and camera model EXIF tag in bottom right corner, aligned in tiles 3×2, scaled with Lanczos filter and saved in high quality.

montage *.jpg \
-auto-orient \
-resize 1000x1000^ \
-gravity center \
-extent 1000x1000 \
-font DejaVu-Sans \
-fill white \
-pointsize 36 \
-background black \
-gravity southeast \
-annotate +20+20 "%t %[EXIF:Model]" \
-tile 3x2 \
-geometry +0+0 \
-filter Lanczos \
-quality 95 \
montage.jpg

Test of MONTAGE in ImageMagick

Create test input images.

$ magick -size 500x500 canvas:"#FFB3BA" 1.jpg
$ magick -size 500x500 canvas:"#FFDFBA" 2.jpg
$ magick -size 500x500 canvas:"#FFFFBA" 3.jpg
$ magick -size 500x500 canvas:"#BAFFC9" 4.jpg
$ magick -size 500x500 canvas:"#BAE1FF" 5.jpg
$ magick -size 500x500 canvas:"#D5BAFF" 6.jpg

Create montage.

$ montage ?.jpg \
-auto-orient \
-resize 1000x1000^ \
-gravity center \
-extent 1000x1000 \
-font DejaVu-Sans \
-fill black \
-pointsize 36 \
-gravity southeast \
-annotate +20+20 "%t" \
-tile 3x2 \
-geometry +0+0 \
-filter Lanczos \
-quality 80 \
montage.jpg

View montage.

$ geeqie montage.jpg

Creating video with KDEnlive on FreeBSD

Importing and renaming raw video clips with creating time on FreeBSD.

Import or copy the raw video clips from the camera and store them on a temporary local fast file system. Rename the raw video clips, so the filename contains the time stamp. This will become convenient later, when listing and loading them. The following csh script uses the stat utility to get the file creation time stamp and then renames the video clips accordingly.

$ cat rename-mp4
#!/bin/csh
foreach file (*.MP4)
  set newname = `stat -f '%SB' -t '%y%m%d-%H%M%S' "$file"`
  mv "$file" "${newname}-${file}"
end

An example of the manual approach, for the same result, would be the following commands.

$ mv MGR103.MP4 240314-213544-MGR103.MP4
$ mv MGP101.MP4 240314-213535-MGP101.MP4

Creating a new project and profile preset in KDEnlive.

Launch KDEnlive and create a new project. KDEnlive will ask you to select a profile preset. In the settings, select or create a profile preset, that matches the raw video clips from the camera and the main format, you will be targetting. If you will be creating a new profile preset, find a general profile preset and I recommend using a naming convention, that reflects the resolution and frame rate.

  • Action cameras, such as the legendary GoPro Hero 3 Black, produces high resolution frames in more narrow aspect ratio and high frame rate, such as 1920×1080@60 (16:9).
  • Cam corders, such as the legendary Sony FDR AX43, produces high resolution frames in traditional film aspect ratio and frame rate, such as 3840×2160@25 (16:9) or 1920×1080@25 (19:6).
  • Mobile phoes, such as Samsung Galaxy A series, produces moderate resolution frames, such as 1920×1080@25 (16:9) or 1080×1920@25 (9:16).

Editing video and audio on the timeline i KDEnlive.

Adding effects i KDEnlive.

If you want to add a watermark, also known as an overlay, you will need an image with your logo or watermark. If the watermark is transparent, it will most likely be in PNG format. Add a track on top of the video in the timeline and place the watermark in it. Stretch it, so it matches the full length of the video. You can now place the watermark, where you want it to be, by opening the effects window, finding the transformation effects and selecting the Crop, Scale and Tilt effect. Adjust the scale and tilt values as necessary. If the video is 1080 pixels wide and the watermark is 200 pixels wide, you might want to scale to 20 and 20 and tilt to 953 and 1779.

Exporting video clips for other use.

If you will be exporting video clips for other use, then use the input and output markers to export those at this point and before any formatting and watermarking. Use a naming convention, that keeps the clips in chronological order, such as a time based prefix and a descriptive tekst. Such clips can later be formatted and watermarked with KDEnlive or FFmpeg for sharing or use on social media.