Coders Packet

Steganography in Python

By Swapnil

Image steganography is the process of hiding information within an image. This Program in Python is utilized to hide a text-based message within an image.


Steganography is a way of hiding critical information. Unlike cryptography, which focuses on encrypting the data, steganography focuses on concealing the data, and in this way, the intended secret message does not attract attention to itself as an object of scrutiny.

This project is a simple example of concealing a hidden message in an image file with two parts-

The first is a decoding function that can extract secret information from an image file and the second is an encoding function that will encode secret messages into images.


$pip install pillow

$pip install stepic

$pip install crytography


Code is in Python

Library used-

Stepic library for encoding and decoding purpose

Pillow library for loading the image

cryptography for encoding message


To run -

$python3 steganography.ipynb

To run this code save the image in which the message to be encoded in the same file directory.

Change demo.png with the image_name+extension and also change the demo secret message- Valar Morghulis with your secret message.

Two methods are used for steganography-

1. Without encrypting the message that is message is saved as it is

2. Using cryptography library the message is encoded to some text and stored as a new image and then decrypted to get hidden text

Download Complete Code


No comments yet