diff --git a/IMAGES & PHOTO SCRIPTS/Image-Inverter/README.md b/IMAGES & PHOTO SCRIPTS/Image-Inverter/README.md deleted file mode 100644 index 2e9f97c1..00000000 --- a/IMAGES & PHOTO SCRIPTS/Image-Inverter/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Image-Inverter - -## Describtion -This project is an implementaion of a CLI program that inverts image/set of images. - -## Requirements -First, you need to install `pillow` module. You can check the official instructions [here](https://pillow.readthedocs.io/en/stable/installation.html) and follow the instructions according to the OS you are running. - -## Examples -### Command -`./inverter.py /your/path/to/image.jpg /another/img.png` - -OR: you can use `-v` or `--verbose`: -`./inverter,py -v /your/image.webp` - -NOTE: **output** images will be generated in the **current working directory** -### Before -![Flower's Normal Image](https://github.com/omar-danasoury/Python-project-Scripts/blob/25c0a96bc74e762bf74b9b33c56372e9d4f23837/IMAGES%20&%20PHOTO%20SCRIPTS/Image-Inverter/before.png) - -### After -![Flower's Inverted Image](https://github.com/omar-danasoury/Python-project-Scripts/blob/25c0a96bc74e762bf74b9b33c56372e9d4f23837/IMAGES%20&%20PHOTO%20SCRIPTS/Image-Inverter/after.png) diff --git a/IMAGES & PHOTO SCRIPTS/Image-Inverter/after.png b/IMAGES & PHOTO SCRIPTS/Image-Inverter/after.png deleted file mode 100644 index 008a2cc1..00000000 Binary files a/IMAGES & PHOTO SCRIPTS/Image-Inverter/after.png and /dev/null differ diff --git a/IMAGES & PHOTO SCRIPTS/Image-Inverter/before.png b/IMAGES & PHOTO SCRIPTS/Image-Inverter/before.png deleted file mode 100644 index 42a38bf2..00000000 Binary files a/IMAGES & PHOTO SCRIPTS/Image-Inverter/before.png and /dev/null differ diff --git a/IMAGES & PHOTO SCRIPTS/Image-Inverter/inverter.py b/IMAGES & PHOTO SCRIPTS/Image-Inverter/inverter.py deleted file mode 100755 index 6399902a..00000000 --- a/IMAGES & PHOTO SCRIPTS/Image-Inverter/inverter.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 - -from PIL import Image, ImageOps, UnidentifiedImageError -import sys, os - -def check_input(): - """ Checks if the script is called with no input parameters. """ - if len(sys.argv) == 1: - print("Please provide image files to operate on!") - sys.exit(1) - -def main(): - """ The main function """ - check_input() - - verbose_enabled = False - if ("-v" in sys.argv) or ("--verbose" in sys.argv): - verbose_enabled = True - - i = 0 - for file in sys.argv: - # To ignore the first parameter -> the script call + -v + --verbose - if i == 0 or sys.argv[i] == "-v" or sys.argv[i] == "--verbose": - i = i + 1 - continue - - image_path_no_ext, extension = os.path.splitext(file) - - try: - with Image.open(file) as image: - new_path_with_ext = image_path_no_ext + "_inverted" + extension - ImageOps.invert(image).save(new_path_with_ext) - if verbose_enabled: - print("Successfully inverted " + file + "\n" + new_path_with_ext + " is generated.\n") - except UnidentifiedImageError: - print(file + " is not suppotred, please provide a supported file type.") - i = i + 1 - -if __name__ == '__main__': - main()