I am trying to understand how text is stored in images in LSB.

If we consider a 24 bit image, we have 3 values per pixel (RGB). So we can store 3 bits in a pixel. So how do we store 'A' or any other character in this situation? Do we store 6 bits in 2 consecutive pixels and then last 2 bits in RG of next pixel and then start storing the first bit of next character from B of the same pixel?

Also, is there a standard for this? E.g. should we start from the first pixel always? If not, is there a way to guess by looking at the pixel values from where the data is stored?

  • $\begingroup$ there is no standard, use whatever works without looking obvious. $\endgroup$
    – dandavis
    Apr 2, 2017 at 19:31
  • $\begingroup$ As long as you aren't prepending or appending anything, you're fine. If you are, it isn't really stego. $\endgroup$
    – floor cat
    May 3, 2017 at 6:15

1 Answer 1


There is no standard. But since the goal of steganography is undetectability, it is not usual to hide data into consecutive pixels. Steganography hiding data into all the pixels is broken.

Some algorithms use a function that detects areas of the image where the insertion produces less distortion along with a PRNG.

See, for example: https://hal.archives-ouvertes.fr/hal-00541353/document


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.