Image Steganography: A Comprehensive Guide In 2021


Human beings have, from time immemorial, been trying to pass on messages in a code and encrypted way to ensure the information does not leak anywhere in the middle and reaches the intended recipient. There are several methods that have been adopted to achieve this stealth. Two ways that are most frequently used but follow two completely different techniques are Cryptography and Steganography.

While Cryptography is used to scramble the message into an indecipherable form and can be unscrambled using an encryption key, Steganography involves hiding the original message in its original form within an inconspicuous or innocent-looking object. Let’s get a little deeper into Steganography and Image Steganography to get more familiar with them.

In this article let us look at:

  1. What is Steganography?
  2. Understanding Image Steganography
  3. Image Steganography Demonstration
  4. Image Steganography Techniques
  5. Image Steganography Tools

1. What is Steganography?

Steganography is the practice of passing messages or information to the recipient, concealed in an object that can take the form of a message, image, text and many other forms, in a completely inconspicuous way. The word Steganography is obtained from two Greek words, ‘stegos’ – to cover, and ‘grayfia’- writing, which translates to ‘hidden writing’.

If done well, Steganography might be able to hide messages better than Cryptography. In the case of Cryptography, you know there is an attempt to hide the data, but with Steganography, it will never be apparent to a third party.

Image Steganography is a method that uses image files to hide the original information. 

2. Understanding Image Steganography

The image used to hide away the original secret information is called Cover-Image, and the image that contains the secret message and looks similar to the original image obtained after steganography is called Stego-Image. Some knowledge of binary numbers, pixels and colour models is required to fully grasp the concept of Steganography. 

A pixel is the smallest building block of an image, and the colour that the pixel holds is a function of a colour scheme. In our case, lets assume RGB or Red Green Blue. A pixel with a value of 0,0,1 would mean the pixel should hold the colour combination of Red=0, Green=0, Blue=1, making the pixel shine a sharp Blue.

Let’s consider an 8-bit system for pixel representation. 8 bit would mean each pixel will have 8 bits to store information about its colour. Going by the binary numbering system, you can represent a total of 255 RGB colours using 8 bits, with each colour being represented by a series of 8 bits. As an example, here is a pixel with its 8-bit components of Red, Green and Blue.

  Red (R) Green(G) Blue (B)
Pixel 00101101 00011100 11011100


Now consider 3 pixels, with each pixel having color coded in the way shown below.

  Red (R) Green(G) Blue (B)
Pixel 1 00101101 00011100 11011100
Pixel 2 10100110 11000100 00001100
Pixel 3 11010010 10101101 01100011


Our secret code is 200, which in binary representation would be written as 11001000. To hid this binary data into the pixel data given above without altering the color, you could replace the least significant bit (which is the rightmost bit) in each 8-bit series with numbers from the binary version of our secret code 200, as shown below. The bits in red, when read together, will give you the secret code 200(in binary version).

  Red (R) Green(G) Blue (B)
Pixel 00101101 00011101 11011100
Pixel 2 10100110 11000101 00001100
Pixel 3 11010010 10101100 01100011


The pixel information has changed, but the image rendered will not be contrastingly different from the original. This way, when you send an image across with altered pixel information, you are sending a secret code embedded in the image file.

3. Image Steganography demonstration

This demonstration of Image Steganography assumes some programming skills in R. 

The idea is to use an image of a kitten as Cover-Image to get the Stego-Image that does not show any apparent difference when rendered.

This demonstration requires the installation of a community package called stegosaur. Use the command below to install the package.



After having loaded the package, the below code extract will encode the message into an image file of a kitten.

kitty is a variable name referring to the image file of a kitten.

stegasaur::encode(“This is the secret code for our secret meeting 10102003030302029848”, kitty,”kitty2.png” )

This will encode the message “This is the secret code for our secret meeting 10102003030302029848” into the image file represented by the variable name kitty and store the resultant image data into a file named kitty2.png.

When you look at the images set side by side, there is no apparent difference between the two. The first image is the original file kitty.png, and the second image is the Stego-Image, kitty2.png.

To get back the encoded information, you can use the decode function from the same package as below.

stegasaur::decode(“kitty2.png”), which will result in the secret message, which is,

This is the secret code for our secret meeting 10102003030302029848

4. Image Steganography Techniques

The above-discussed method is the Spatial Domain Technique. Multiple Steganographic techniques exist like, 

1) Spatial Domain

Also known as substitution technique, are a group of simple techniques that take advantage of the Human Visual System. The changes made are likely to be inapparent to the naked eye untrained eye.

2) Transform Domain

The transform domain techniques rely on compression functions like Wavelet transform and JPEG Steganography to transform special domain information into frequency domain information.

Other known techniques are Spread Spectrum, Statistical Methods and Distortion Techniques.

5. Image Steganography tools

The above demonstration was carried out within a programming environment, but there are other tools available that help with encoding your data into images, text files, videos and so on.

There are many tools available online for carrying out Image Steganography like Xiao Steganography, Steghide, Crypture, SteganographX Plus, rSteg and many more.


The one major advantage that Image Steganography has over encryption is that it is inconspicuous by nature. Meaning, you won’t be able to detect that there is a hidden message being passed along with the file, while in encryption since the message is encrypted, one gets to immediately that the data being exchanged is of a secretive nature.

So, have you made up your mind to make a career in Cyber Security? Visit our Master Certificate in Cyber Security (Red Team) for further help. It is the first program in offensive technologies in India and allows learners to practice in a real-time simulated ecosystem, that will give you an edge in this competitive world.


Related Articles

Please wait while your application is being created.
Request Callback