Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Adarsh275/Image-Transformation/llms.txt

Use this file to discover all available pages before exploring further.

Image Transformation is a command-line tool that performs ten distinct image processing operations entirely from scratch in Python. Rather than delegating work to a heavy computer-vision library like OpenCV, every algorithm — from Sobel edge detection to pixel-level color inversion — is implemented directly using NumPy array operations and Matplotlib’s image I/O. This makes the project an ideal reference for understanding how image transformations actually work under the hood, and a lightweight utility for anyone who wants to process images without adding large binary dependencies to their environment.

Why Image Transformation?

Most image processing workflows reach for OpenCV as a first instinct. Image Transformation deliberately avoids that path. The algorithms are transparent, readable Python, so you can study the Sobel convolution kernel, the luminosity-weighted grayscale formula, or the rotation matrix math directly in the source code. The primary runtime dependencies are NumPy and Matplotlib (plus Pillow, which Matplotlib uses as its image I/O backend) — all general-purpose scientific Python libraries already present in most data-science environments.
  • No heavy CV libraries — no OpenCV; all transformation logic is pure Python/NumPy
  • Transparent algorithms — every transformation is pure Python/NumPy you can read and modify
  • Single command interface — all ten operations share the same python main.py <command> <src> <dest> pattern
  • Cross-platform — ships with setup scripts for Linux, macOS, and Windows
  • BSD-2-Clause licensed — permissive license, free to use and adapt

Available Transformations

Image Transformation exposes ten subcommands, each applying a distinct operation to the source image:
CommandWhat it does
detect-edgesApplies Sobel convolution kernels (vertical + horizontal) to detect image edges
grayscaleConverts to grayscale using the luminosity formula (R×0.299 + G×0.587 + B×0.114)
upscaleRepeats pixels along both axes by a given integer factor
downscaleSamples every n-th pixel along both axes to reduce dimensions
flipMirrors the image horizontally (left-right flip)
rotateRotates by an arbitrary angle in degrees using a rotation matrix
invert-colorProduces a photographic negative by bitwise-inverting every channel
contrastClips to the 2nd–98th percentile range and rescales to a user-specified percentage
rgb-channelsIsolates a subset of R, G, and B channels (entered in r→g→b order), zeroing the others
transparencyAdds an alpha channel at a user-specified opacity percentage
Several commands — upscale, downscale, rotate, contrast, rgb-channels, and transparency — prompt you interactively for an additional parameter (such as a scale factor, angle, or percentage) after the command is run. Have your desired value ready before invoking the command.

Project Structure

The project is intentionally small and easy to navigate:
Image-Transformation/
├── main.py              # CLI entry point — parses sys.argv and dispatches commands
├── src/
│   ├── imageEdit.py     # Core imageEdit class — all transformation logic lives here
│   └── usage.py         # Help text returned by --help / -h
├── Input_Image/         # Sample input images (mountains.jpg, building.jpg, car.jpeg, …)
├── Output_Image/        # Default destination for processed images
├── requirements.txt     # NumPy + Matplotlib + supporting packages
├── setup.sh             # Linux/macOS: creates venv and installs requirements
├── setup.ps1            # Windows: PowerShell equivalent of setup.sh
└── activate.ps1         # Windows: shortcut to activate the virtual environment
  • main.py reads sys.argv, validates argument count, and calls the appropriate method on an imageEdit instance.
  • src/imageEdit.py contains the imageEdit class with loadImg(), writeImg(), and one method per transformation.
  • src/usage.py exports a single inf() function that returns the formatted help string printed by --help.

License

Image Transformation is released under the BSD-2-Clause License © 2022 Adarsh Kumar. You are free to use, modify, and redistribute it with or without modification as long as the original copyright notice is retained.

Explore the Docs

Installation

Set up your virtual environment and install dependencies on Linux, macOS, or Windows.

Quickstart

Transform your first image in under two minutes with three concrete examples.

Command Reference

Full reference for all ten subcommands, their arguments, and output file naming.

API Reference

Browse the imageEdit class methods, parameters, and NumPy implementation details.

Build docs developers (and LLMs) love