How to hide something in an image

So the question is how to hide an image (or text) inside another image so people only see the main image. The technique I describe is well known and commonly used in steganography. To understand it you must be knowledgeable about bits and bytes.

When an image is stored in RAM , each pixel is a 32-bit integer, comprising of four 8-bit channels i.e. ARGB. This diagram shows how the channels are arranged inside the integer - example graphic

The four channels are

  • alpha (transparency)
  • red
  • green
  • blue

and each channel is just a single byte e.g.

example graphic

MSB = most significant bit
LSB = least significant bit

Steganogrohy takes advantage of the fact that the 4 least significant bits (0-3) have virtually no visible effect on the actual colour displayed. It means that we can have any values we like in bits 0-3 without the effect being visible in the image.

Therefore we can use up to 4 bits per channel (bpc) to store another image or text.

example graphic

If the carrier image is not using the alpha channel then Steganos doesn't use it either because it would be obvious that there is more to the image than meets the eye. In that case the library only uses the 12-bits available in the RGB channels e.g.

example graphic

Depending on the size of the image or text to hide then it may not be necessary to use all 12 bits. Sterganos calculates the number of bits per channel (bpc) in the carrier image needed to store the burden.

Image Burden

To minimise the amount of information to hide Steganos the alpha channel is only stored if the burden image uses it.

It would be normal that the burden image to have significantly smaller number of pixels than the carrier image. Sometimes this will not be the case and the library will automatically ignore the LSBs in the burden image to ensure that no more than 4 bpc of the carrier image are used.

Text Burden

Text is first converted tp UTF8 before embedding into the carrier image. Unlike image burdens the library will use all the bits making up the text.

 

Important note:

Steganos will not create the stegan if it has to use more than 4 bpc of the carrier image. If in doubt the library allows you to analyses a carrier image / burden pairing and see if it is