This Python script allows you to encode any file into a PNG image and decode it back, using steganography techniques. The tool modifies the least significant bits of the image's pixel values to store the data, making the changes imperceptible to the human eye.
- Python 3.x
- Pillow (PIL) library
- Clone this repository or download the script.
- Install the required dependencies:
pip3 install Pillow
python3 anyFile.py encode <input_file> <output_image.png>
Example:
python3 anyFile.py encode hamlet.txt cat.png
This will encode the contents of hamlet.txt
into cat.png
. The resulting image will look identical to the original to the human eye.
python3 anyFile.py decode <input_image.png> <output_file>
Example:
python3 anyFile.py decode cat.png message.txt
This will extract the hidden data from cat.png
and save it to message.txt
.
- The script converts the input file to binary data.
- It then modifies the least significant bit of each color channel in each pixel of the PNG image to store this binary data.
- When decoding, it reads these least significant bits to reconstruct the original file.
- Only PNG images are supported due to their lossless compression (BMP and other lossless formats may work).
- The size of the data you can hide is limited to about 3 bits per pixel.
Feel free to fork this project and submit pull requests with improvements or bug fixes.