Skip to content

om-jadhav/Pixel-Manipulation-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

🖼️🔐 Pixel Manipulation Image Encryption Tool

A Linux-based Python CLI tool that demonstrates image encryption using pixel manipulation techniques. This project focuses on educational cryptography, showing how pixel-level operations can protect image data and why simple substitution-based encryption has limitations.

📌 Overview

This tool encrypts and decrypts images by modifying RGB pixel values using a symmetric key. Instead of scrambling pixel positions, it applies XOR-based substitution, preserving the spatial structure of the image while altering its color information.

This project was developed as part of a Cybersecurity Internship task to understand low-level image encryption concepts.

🧠 What is Pixel Manipulation?

Pixel manipulation is a technique where:

Each pixel’s color values (R, G, B) are accessed directly

Mathematical or logical operations are applied to these values

Pixel positions remain unchanged

In this tool:

(R, G, B) → (R ⊕ key, G ⊕ key, B ⊕ key)

Where ⊕ represents the XOR (exclusive OR) operation.

❓ Why the Encrypted Image Is NOT Scrambled

This is expected behavior and an important learning outcome.

✔ What changes:

Pixel color values

Visual appearance (color distortion)

❌ What does NOT change:

Pixel positions

Image structure

Object layout

This happens because the encryption uses substitution only, not permutation.

This demonstrates the limitation of simple pixel-based encryption and highlights the need for stronger techniques such as diffusion, pixel shuffling, or AES-based encryption.

🔑 Key & Password Handling

The tool supports multiple key generation methods:

🔐 Manual Key

A numeric key (0–255) directly used for encryption.

🔑 Password-Based Key

Password is hashed using SHA-256

A numeric key is derived from the hash

Password is never stored or used directly

Password → SHA-256 → Numeric Key → Encryption

🎲 Random Key

Cryptographically secure random key generation

Useful for session-based encryption

🛠️ Features

🖥️ CLI-based Linux tool

🔒 Image encryption using pixel manipulation

🔓 Image decryption using the same key

🔑 Password-based key derivation (SHA-256)

🎲 Random key generation

🔁 Reversible encryption (symmetric)

🐧 Packaged as a Linux executable

📦 Requirements

-- Python 3.x

-- Pillow (PIL)

-- Install dependency:

-- pip3 install pillow

🚀 Usage

🔐 Encrypt Image (Password-Based)

python3 imgcrypt.py encrypt -i image.png -o encrypted.png --password cyber123

🔓 Decrypt Image

python3 imgcrypt.py decrypt -i encrypted.png -o decrypted.png --password cyber123

🎲 Encrypt with Random Key

python3 imgcrypt.py encrypt -i image.png -o encrypted.png --random-key

🔑 Encrypt with Manual Key

python3 imgcrypt.py encrypt -i image.png -o encrypted.png --key 120

🐧 Packaging as a Linux Tool

To run the tool like a native Linux command:

chmod +x imgcrypt.py dos2unix imgcrypt.py sudo mv imgcrypt.py /usr/local/bin/imgcrypt

Run from anywhere:

imgcrypt --help

🧪 Example Workflow

-- Encrypt image using password

-- Observe color distortion without scrambling

-- Decrypt using the same password

-- Original image is restored perfectly

🧠 Learning Outcomes

-- Understanding pixel-level image encryption

-- Difference between substitution and permutation

-- Why passwords must be converted into cryptographic keys

-- Importance of secure randomness

-- Limitations of simple encryption techniques

⚠️ Disclaimer

This project is intended for educational purposes only. It demonstrates basic image encryption concepts and should not be used for real-world secure communication.

👨‍💻 Author

Developed by Om Jadhav Cybersecurity Intern – Prodigy Infotech

⭐ If you find this useful

Consider giving the repository a ⭐ and sharing feedback!

About

A Linux-based Python CLI tool that demonstrates image encryption using pixel manipulation techniques. This project focuses on educational cryptography, showing how pixel-level operations can protect image data and why simple substitution-based encryption has limitations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages