This Python script provides a simple image encryption and decryption tool using pixel manipulation. The tool allows users to encrypt and decrypt images by swapping pixel values based on a provided key.
- Encrypt Images: Randomly swaps pixel values to encrypt the image.
- Decrypt Images: Reverses the pixel swaps to restore the original image.
- Key Confirmation: Ensures that only users with the correct key can encrypt or decrypt the image.
- Python 3.x
- Pillow library
-
Install Python 3.x from the official website.
-
Install the Pillow library using pip:
pip install pillow
To encrypt an image, use the following command:
python3 image_en_decrypt.py encrypt <input_image_path> <output_image_path> <key>
Example:
python3 image_en_decrypt.py encrypt path/to/your/image.jpg path/to/save/encrypted_image.jpg 24
To decrypt an image, use the following command:
python3 image_en_decrypt.py decrypt <input_image_path> <output_image_path> <key>
Example:
python3 image_en_decrypt.py decrypt path/to/save/encrypted_image.jpg path/to/save/decrypted_image.jpg 24
When you run the script, you will be prompted to confirm your key. If the entered key does not match the provided key, the script will print a message indicating that the image is not intended for you.