Skip to content

Magwerste/imageeditor

Repository files navigation

Image Editor

A small Python tool that batch-edits images: it corrects EXIF-based orientation, sharpens the image, and boosts contrast, then writes the results to an output directory.

Features

  • EXIF orientation correction - rotates images according to their EXIF orientation tag and resets the tag afterwards, so the result displays correctly everywhere instead of being rotated twice by orientation-aware viewers.
  • Sharpening via an unsharp mask filter, with configurable radius, percent, and threshold.
  • Contrast enhancement with a configurable factor.
  • Batch processing of an entire directory, skipping unsupported files and continuing past unreadable ones instead of aborting the run.
  • Composable pipeline - each edit is a small step implementing a common interface, so new steps (e.g. resizing, watermarking) can be added without touching existing code.

Installation

pip install -r requirements.txt

Or install as a package (adds an imageeditor command):

pip install .

Usage

Run over the bundled sample images:

python -m imageeditor.cli

Or, with custom options:

python -m imageeditor.cli \
    --input-dir path/to/images \
    --output-dir path/to/output \
    --contrast 1.3 \
    --sharpen-radius 2.5 \
    --sharpen-percent 175 \
    --sharpen-threshold 3

Run python -m imageeditor.cli --help for the full list of options.

Project structure

src/imageeditor/
    editor.py   - core pipeline: EditStep protocol, SharpenStep,
                  ContrastStep, ExifOrientationCorrector, BatchImageEditor
    cli.py      - command-line entry point
tests/
    test_editor.py
examples/sample_images/
    sample stock images used to try the tool out

Design

Each edit is a small object implementing an EditStep protocol (apply(image) -> image). BatchImageEditor takes a list of steps and applies them in order to every supported image in a directory. This keeps each transformation independent and testable, and makes it straightforward to add new steps or reorder existing ones without changing the batch processing logic.

Running tests

pip install -e ".[dev]"
pytest

Sample images

The images in examples/sample_images/ are royalty-free stock photos included only to demonstrate the tool; they contain no personal or identifying metadata.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages