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.

This guide assumes you have already installed Image Transformation and have an active virtual environment. If you have not done that yet, complete the Installation guide first, then come back here. All examples below use the sample images that ship inside the Input_Image/ directory of the repository, so you can run every command exactly as written without needing your own image files.

CLI Syntax

Every Image Transformation command follows the same three-argument pattern:
python main.py <command> <src> <dest>
  • <command> — one of the ten transformation subcommands (see the table in the Introduction)
  • <src> — full or relative path to the source image file (JPEG, PNG, etc.)
  • <dest> — path to the output directory where the processed image will be saved
The output filename is constructed automatically as <original-stem>_<suffix><original-extension>. For example, running grayscale on mountains.jpg produces mountains_grayscale.jpg in the destination directory.
Six commands — upscale, downscale, rotate, contrast, rgb-channels, and transparency — pause after you run them and prompt you to enter an additional parameter interactively (a scale factor, rotation angle, contrast percentage, channel string, or transparency percentage). The other four commands (detect-edges, grayscale, flip, invert-color) run to completion without any further input.

Quickstart Walkthrough

1

Convert a photo to grayscale

The grayscale command uses the luminosity formula (R×0.299 + G×0.587 + B×0.114) to convert a colour image to a perceptually-weighted grayscale representation. It requires no additional input.
python main.py grayscale Input_Image/mountains.jpg Output_Image/
Expected terminal output:
Converting image to grayscale
Saving image
Done
Output file: Output_Image/mountains_grayscale.jpg
Make sure the Output_Image/ directory exists before running any command, or replace it with any existing directory path on your system.
2

Run edge detection on a photo

The detect-edges command applies vertical and horizontal Sobel convolution kernels to identify edges in the image. Like grayscale, it runs entirely non-interactively.
python main.py detect-edges Input_Image/building.jpg Output_Image/
Expected terminal output:
Detecting edges on image
Saving image
Done
Output file: Output_Image/building_edge.jpgThe algorithm internally calls grayscale() first, then applies the Sobel kernels to the single-channel result. Edge scores are normalised to the [0, 1] range before saving.
3

Flip an image horizontally

The flip command mirrors the image left-to-right using NumPy’s fliplr. No parameters needed.
python main.py flip Input_Image/car.jpeg Output_Image/
Expected terminal output:
Flipping image
Saving image
Done
Output file: Output_Image/car_flipped.jpeg

Output Filename Reference

The output filename is always built from the source file’s stem plus a fixed suffix:
CommandSuffix appendedExample output filename
detect-edges_edgebuilding_edge.jpg
grayscale_grayscalemountains_grayscale.jpg
upscale_upscaledmountains_upscaled.jpg
downscale_downscaledmountains_downscaled.jpg
flip_flippedcar_flipped.jpeg
rotate_rotated_<angle>car_rotated_90.jpeg
invert-color_negativebuilding_negative.jpg
contrast_contrastmountains_contrast.jpg
rgb-channels_channel_<channels>mountains_channel_rg.jpg
transparency_transparency<percentage>mountains_transparency50.0.jpg

The --help Output

Run python main.py --help (or python main.py -h, or python main.py with no arguments) to see the full usage reference at any time:
Usage:
    python main.py <Option> src dest
    
Option:
    --help      -h      Loads this message
    detect-edges        Perform edge detection on given image
    grayscale           Convert image to grayscale
    upscale             Upscale image
    downscale           Downscale image
    flip                Flips the image
    rotate              Rotate image by given angle
    invert-color        Invert colors of the image
    contrast            To adjust contrast of image
    rgb-channels        To obtain image containg only r,g or b or a mixture of those
    transparency        To add transparency to images


src - source of image
dest - destination location to save image

Interactive Commands: What to Expect

When you run one of the six interactive commands, the program halts and waits for you to type a value. Here is what each prompt looks like and what kind of input is expected:
CommandPromptExpected input
upscaleEnter scaling factor:Positive integer (e.g. 2 doubles the resolution)
downscaleEnter downscale factor:Positive integer (e.g. 2 halves the resolution)
rotateEnter angle in degrees:Integer angle in degrees (e.g. 90, 45, 180)
contrastEnter contrast percentage:Integer 0–100 (e.g. 80)
rgb-channelsEnter channel composition:Letters r, g, b in that order (e.g. r, rg, rgb, gb); validated against regex ^r?g?b?$
transparencyEnter transparency percentage:Float 0–100 (e.g. 50.0 gives 50% opacity)
Entering a value outside the expected type (for example, a non-integer for upscale) will raise a Python ValueError. For rgb-channels, the input is validated against the regex ^r?g?b?$ — letters must appear in the order r, then g, then b (e.g. rg is valid; gr is not). The command re-prompts until a valid value is entered.

Next Steps

Command Reference

Detailed documentation for every subcommand — arguments, interactive prompts, output naming, and edge cases.

API Reference

Explore the imageEdit class internals, method signatures, and the NumPy algorithms behind each transformation.

Build docs developers (and LLMs) love