Master Image Steganography with Python: Hide Secrets in Pictures 🖼️
Learn how to hide and extract messages within images using Python. This comprehensive guide covers the fundamentals of image steganography for secure data concealment.

Abhinav Duvvuri
2.8K views • Aug 26, 2020

About this video
Steganography is the practice of concealing messages or information within other non-secret text or data. In this project, we are concealing information inside images and hence the name “Image Steganography”. The information we are hiding can either be text or other images. Broadly speaking, the project aims at hiding images/text inside images.
This can be achieved by the following four scenarios:
Hiding text inside a grey-scale image.
Hiding a text inside an RGB image.
Hiding a grey-scale image inside an RGB image.
Hiding an RGB image inside another RGB image.
For hiding text inside a grey-scale image, the LSB method is used. The text to be hidden is first converted in 8-bit ASCII and then appended with a 128-bit pattern on both sides. This pattern will help while decrypting the message as we will have a specific bit pattern to look for. Next, a random pixel is chosen in the image and for every pixel thereon, the 8th (Least Significant Bit) bit is adjusted by adding/subtracting a few intensity values in such a way that it matches a 0(for even) or a 1(for odd) binary value. This is encryption. While decrypting, the 128-bit pattern is searched by the function and the bits between the two 128 bit patterns is extracted and converted to text.
For hiding text into an RGB image, a similar approach is used except that one of the three channels(R, G, B) is used instead of the grey intensity values used in the above scheme.
For hiding an image(RGB or grey-scale) inside an RGB image, we use a method called 4-MSB. We only store the 4 most significant bits of both the images. The 4-MSB of the hidden image are stored as the 4-LSB’s in order to be hidden. The following are the steps performed: First both the images are converted into the same resolution. Next, the MSB’s of the image that needs to be hidden are swapped with the 4-LSB’s of the carrier image(the image which acts as the medium of transfer). While extracting, the 4-LSB’s of the carrier image are extracted and placed as MSB’s in an empty image. The remaining bits are filled randomly with intermediate values.
This is how Image Steganography for both text and images is achieved in this project.
Link to the project: https://github.com/abhinavdv/image-steganography
This can be achieved by the following four scenarios:
Hiding text inside a grey-scale image.
Hiding a text inside an RGB image.
Hiding a grey-scale image inside an RGB image.
Hiding an RGB image inside another RGB image.
For hiding text inside a grey-scale image, the LSB method is used. The text to be hidden is first converted in 8-bit ASCII and then appended with a 128-bit pattern on both sides. This pattern will help while decrypting the message as we will have a specific bit pattern to look for. Next, a random pixel is chosen in the image and for every pixel thereon, the 8th (Least Significant Bit) bit is adjusted by adding/subtracting a few intensity values in such a way that it matches a 0(for even) or a 1(for odd) binary value. This is encryption. While decrypting, the 128-bit pattern is searched by the function and the bits between the two 128 bit patterns is extracted and converted to text.
For hiding text into an RGB image, a similar approach is used except that one of the three channels(R, G, B) is used instead of the grey intensity values used in the above scheme.
For hiding an image(RGB or grey-scale) inside an RGB image, we use a method called 4-MSB. We only store the 4 most significant bits of both the images. The 4-MSB of the hidden image are stored as the 4-LSB’s in order to be hidden. The following are the steps performed: First both the images are converted into the same resolution. Next, the MSB’s of the image that needs to be hidden are swapped with the 4-LSB’s of the carrier image(the image which acts as the medium of transfer). While extracting, the 4-LSB’s of the carrier image are extracted and placed as MSB’s in an empty image. The remaining bits are filled randomly with intermediate values.
This is how Image Steganography for both text and images is achieved in this project.
Link to the project: https://github.com/abhinavdv/image-steganography
Video Information
Views
2.8K
Likes
62
Duration
14:01
Published
Aug 26, 2020
User Reviews
4.5
(2) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
Trending Now