You are here: Home / Journal / Almost SooC left and right images swapped

Almost SooC left and right images swapped

These are some almost SooC images BUT with left and right images swapped. They were captured with my recently constructed stereo camera module. This is part of an ongoing project to create a modular GNU/Linux digital camera system using easily available generic components. 

Although the images themselves are unedited, the left and right images have been swapped over, using a simple BASH shell script (detailed below). Thus they behave as 3d cross-eyed pairs. To view them in 3D simply cross your eyes slightly until a third image appears between the two photos. If you are doing it correctly then this third image will be in 3D. The silver-coloured mannequin and model Estella Rose will clearly be in the foreground.

Gallery of simple cross eyed stereo pairs

Bash script

#!/bin/bash

# garf-crosseeyed
# 
# By Garfield Lucas.
# Updated 2026-05-19.
#
# Converts horizontal stereo pairs into horizontal cross-eyed stereo pairs
# by swapping the left and right halves.
# Works on entire current directory and creates a new subdirectory for the new file(s).
# 
# Usage ./garf-crosseyed *.jpg or ./garf-crosseyed *.png
# 
# May also work on other image formats.
#
# Input must be:
# Side-by-side image
# Total size: 3200x1600
# Left eye : 1600x1600
# Right eye: 1600x1600.
#
# Output saved into ./crosseyed
# Original filename(s) preserved
#
# Requires: ImageMagick ("magick" command)

# Exit on errors, undefined variables, or failed pipelines
set -euo pipefail

# Make subdirectory "crosseyed"
mkdir -p crosseyed

# Process every file given on the command line
for img in "$@"; do
[ -f "$img" ] || continue

filename=$(basename "$img")

magick "$img" \
\( -clone 0 -crop 1600x1600+1600+0 +repage \) \
\( -clone 0 -crop 1600x1600+0+0 +repage \) \
-delete 0 \
+append \
"crosseyed/$filename"

echo "Created: crosseyed/$filename"
done

Copy and paste the above script to a text file and save it as “garf-crosseyed”. Don’t forget to change its permissions to make it executable. From the same directory run the following command.

chmod +x garf-crosseyed

Credits

With many thanks to my friend and model Estella Rose for dressing up in her “Dorothy Gale” costume and posing for some test images.

Slightly similar posts...

Leave a Reply

Your email address will not be published. Required fields are marked *