Skip to main content

CLI tool for creating composites by alternating rows/columns from two images

Project description

Image Interlacement Program

A Python CLI tool for creating composites by alternating rows or columns from two images.

Overview

This program allows you to create unique composite images by interleaving pixels from two images row-by-row or column-by-column. For example, combine two photos so that alternating rows come from each image, creating an interesting blended visual effect.

Features

  • Row-based Compositing - Alternate entire rows of pixels from two images
  • Column-based Compositing - Alternate entire columns of pixels from two images
  • CLI Interface - Easy-to-use command-line interface
  • Future Enhancements - GUI and web app support planned

Installation

You can install and use the Image Interlacement program in two ways:

Option 1: Standalone Executable (Easiest for Non-Technical Users)

No Python installation required!

  1. Go to the Latest Release page
  2. Download the executable for your operating system:
    • macOS (Apple Silicon / M1/M2/M3): image-interlacement (arm64)
    • macOS (Intel): image-interlacement (x86_64)
    • Linux: image-interlacement (x86_64)
    • Windows: image-interlacement.exe
  3. On macOS/Linux, make it executable and run:
    chmod +x image-interlacement
    ./image-interlacement --help
    
  4. On Windows, simply double-click or run from Command Prompt:
    image-interlacement.exe --help
    

Option 2: Python Package via pip (For Developers)

Requires Python 3.8 or higher and pip

Install from PyPI:

pip install image-interlacement

Then run from anywhere:

image-interlacement --help

Or clone and install from source:

git clone <repository-url>
cd image-interlacement-program
pip install -e .
image-interlacement --help

Option 3: Run from Source (For Development)

If you're modifying the code:

  1. Clone the repository:
git clone <repository-url>
cd image-interlacement-program
  1. Create a virtual environment (recommended):
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the program:
python src/main.py --help

Usage

Basic Commands

Create a Row-based Composite

Alternate entire rows from two images:

python src/main.py composite image1.png image2.png output.png --mode rows

Pattern: Output rows are interleaved - Row 0 from image1, Row 1 from image2, Row 2 from image1, etc. The output height will be 2x the input height.

You can also use solid colors instead of image files:

python src/main.py composite image1.png white output.png --mode rows
python src/main.py composite image1.png black output.png --mode rows

Create a Column-based Composite

Alternate entire columns from two images:

python src/main.py composite image1.png image2.png output.png --mode columns

Pattern: Output columns are interleaved - Column 0 from image1, Column 1 from image2, Column 2 from image1, etc. The output width will be 2x the input width.

You can also use solid colors instead of image files:

python src/main.py composite image1.png white output.png --mode columns
python src/main.py composite image1.png black output.png --mode columns

Interlace (same-size) — legacy behavior

Create a same-size interlaced image where even rows/columns come from the first image and odd rows/columns come from the second image.

python src/main.py interlace image1.png image2.png output.png --mode rows
python src/main.py interlace image1.png image2.png output.png --mode columns

Notes:

  • The output image will have the same dimensions as the (tiled) inputs.
  • If input sizes differ, the smaller image will be tiled to match the larger one before interlacing.
  • You can also use white or black in place of an image path.

Dependencies

Package Version Purpose
Pillow >=9.0.0 Image processing and manipulation
NumPy >=1.21.0 Efficient array operations for pixel manipulation

Project Structure

image-interlacement-program/
├── src/
│   ├── __init__.py          # Package initialization
│   └── main.py              # CLI entry point
├── README.md                # This file
├── requirements.txt         # Python dependencies
└── .github/
    └── copilot-instructions.md  # Copilot workspace instructions

Architecture

Current Implementation

  • main.py: CLI argument parser and entry point

Planned Components

  • utils.py - Utility functions for image handling and validation
  • gui/ - GUI interface module
  • web/ - Web application module
  • tests/ - Unit tests

Technical Details

Row-based Compositing

When creating a row-based composite:

  • The output image height will be 2x the input height
  • Output row 0, 2, 4, ... come from image1
  • Output row 1, 3, 5, ... come from image2
  • If one image is smaller, it is tiled (repeated) to match the larger image's size

Column-based Compositing

When creating a column-based composite:

  • The output image width will be 2x the input width
  • Output column 0, 2, 4, ... come from image1
  • Output column 1, 3, 5, ... come from image2
  • If one image is smaller, it is tiled (repeated) to match the larger image's size

Requirements for Input Images

  • At least one input must be an actual image file (cannot use "white" and "black" together)
  • Both inputs must result in the same color channels after processing (RGB)
  • Different dimensions are now supported! Smaller images will be automatically tiled to match the larger image's size
  • Supported formats: PNG, JPG, BMP, TIFF, and other formats supported by Pillow
  • Solid color support: Use white or black instead of a file path to create solid color images

Examples

Example 1: Combine Two Portraits (Row-based)

python src/main.py composite portrait_a.jpg portrait_b.jpg blended_portrait.jpg --mode rows

Creates a portrait composite where alternating horizontal lines come from each image.

Example 3: Interleave with White Background

python src/main.py composite image1.png white output.png --mode rows

Creates a composite where the original image alternates with pure white rows.

Example 4: Interleave with Black Background

python src/main.py composite image1.png black output.png --mode columns

Creates a composite where the original image alternates with pure black columns.

Running the Program

python src/main.py --help

View help for specific commands:

python src/main.py composite --help

Quick Start

  1. Clone/navigate to repository:
git clone https://github.com/rooomba/image-interlacement
cd image-interlacement-program
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a composite:
python src/main.py composite photo1.jpg photo2.jpg output.jpg --mode rows

Troubleshooting

Unsupported Image Format

  • Error: "Cannot identify image file"
  • Solution: Convert images to PNG, JPG, or BMP format. Use an image converter tool.

Different Color Spaces

  • Error: Image mode mismatch
  • Solution: The program automatically converts to RGB if needed. No action required.

Support

For issues or questions, please open an issue in the repository.


Last Updated: December 7, 2025
Version: 0.1.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image_interlacement-0.3.5.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

image_interlacement-0.3.5-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file image_interlacement-0.3.5.tar.gz.

File metadata

  • Download URL: image_interlacement-0.3.5.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for image_interlacement-0.3.5.tar.gz
Algorithm Hash digest
SHA256 b85b03b186b3f2d62fe2e52c77540c562359a64c8d4c504b972c4e1330145730
MD5 17d700cae7b5ce98f0cd2b01a6e4ac53
BLAKE2b-256 a6e14e283f01a69dc84de89f1126a763e1a43d27c202c252b0993e3bea2e094a

See more details on using hashes here.

File details

Details for the file image_interlacement-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for image_interlacement-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f665b1f8757bc788f3e85c49ac752e900033bdc033cb414194183f269f9bdaba
MD5 4582e6ec8362856957f17d6c53dab04b
BLAKE2b-256 dbee0ce43cbb76737caab68eaa333925a92a15a7dd595a356ef5cf04e518d6c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page