Sure, Sreek! Here's your complete README.md content again — ready to copy and paste:
A simple command-line image processing tool built using Python and NumPy that supports grayscale .pgm (Portable GrayMap) images. Features include inversion, thresholding, contrast stretching, statistics, and ASCII art preview.
- ✅ Invert grayscale images
- ✅ Apply thresholding
- ✅ Contrast stretching
- ✅ ASCII preview of images in terminal
- ✅ Show image statistics (mean, std, min, max)
python image_processor.py input.pgm output.pgm [options]| Flag | Description |
|---|---|
--invert |
Inverts the image |
--threshold VAL |
Applies thresholding at a given value |
--contrast |
Enhances contrast via linear stretching |
--ascii |
Shows an ASCII preview before and after |
--stats |
Prints image statistics |
python image_processor.py sample.pgm output.pgm --invert --ascii --stats- Python 3.x
- NumPy
Install NumPy with:
pip install numpyASCII Preview (original and processed)
🖼️ Original Image Preview:
@%%#**+=-:
...
🎨 Processed Image Preview:
@@%%%##**-
Statistics:
Dimensions: 256 x 256
Mean brightness: 127.53
Standard deviation: 20.42
Min pixel: 0
Max pixel: 255
In my journey of learning, this project marks my first milestone — a project built entirely using Python and NumPy! 📈 It helped me understand image processing basics and file manipulation in a hands-on way.
Pull requests are welcome! Feel free to fork and build on this.
This project is licensed under the MIT License.
Absolutely! Here's a clean "How to Run" section you can add to your GitHub README:
- Python 3.x installed
numpylibrary installed (you can install it via pip)
pip install numpy-
Open a terminal and navigate to the project directory.
-
Use the following command format:
python image_processor.py input.pgm output.pgm [options]--invert→ Invert the image colors--threshold VALUE→ Apply binary thresholding at a given value (0–255)--contrast→ Apply contrast stretching--ascii→ Show ASCII art preview--stats→ Show image statistics
python image_processor.py sample.pgm result.pgm --invert --ascii --statsThis will:
- Invert the grayscale image
- Show ASCII previews (before & after)
- Print image statistics to the terminal