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.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.
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:| Command | What it does |
|---|---|
detect-edges | Applies Sobel convolution kernels (vertical + horizontal) to detect image edges |
grayscale | Converts to grayscale using the luminosity formula (R×0.299 + G×0.587 + B×0.114) |
upscale | Repeats pixels along both axes by a given integer factor |
downscale | Samples every n-th pixel along both axes to reduce dimensions |
flip | Mirrors the image horizontally (left-right flip) |
rotate | Rotates by an arbitrary angle in degrees using a rotation matrix |
invert-color | Produces a photographic negative by bitwise-inverting every channel |
contrast | Clips to the 2nd–98th percentile range and rescales to a user-specified percentage |
rgb-channels | Isolates a subset of R, G, and B channels (entered in r→g→b order), zeroing the others |
transparency | Adds 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:main.pyreadssys.argv, validates argument count, and calls the appropriate method on animageEditinstance.src/imageEdit.pycontains theimageEditclass withloadImg(),writeImg(), and one method per transformation.src/usage.pyexports a singleinf()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.