Overview
The steganography command lets you hide a text message inside an image file and later
recover it. The message is stored in the least-significant bits of the R, G, and B channels of
each pixel in scan order, so the visual change to the image is imperceptible to the human eye.
One bit stored per colour channel. Three bits per pixel.
Message is converted to UTF-8 bytes before bit-packing.
Appended to the message so decoding knows where to stop.
SixLabors.ImageSharp handles pixel-level access for all supported formats.
How It Works
Encoding
The message is appended with the sentinel string <<END>>, converted to UTF-8 bytes,
then expanded to a bit array. The bits are written into the least-significant bit of each colour
channel (R, G, B) in left-to-right, top-to-bottom pixel order.
Decoding
The LSBs of R, G, and B are read from each pixel in the same scan order, accumulated into bytes,
and converted back to a UTF-8 string until the <<END>> sentinel is found.
Everything before the sentinel is the recovered message.
Encode
Hide a message inside an image. The output file is a new image with the message bits written into the least-significant channel bits.
| Option | Required | Description |
|---|---|---|
--mode | Yes | Must be encode |
--image | Yes | Path to the input cover image |
--message | Yes (encode) | The plaintext message to hide |
--output | Yes (encode) | Path to write the output stego image |
Decode
Recover a previously hidden message from a stego image. The image must have been produced by the encode mode of this same command.
| Option | Required | Description |
|---|---|---|
--mode | Yes | Must be decode |
--image | Yes | Path to the stego image containing a hidden message |
Command Reference
| Command | Required options | Optional options | Output |
|---|---|---|---|
images steganography --mode encode |
--image --message --output |
— | Stego image written to --output |
images steganography --mode decode |
--image |
— | Recovered message printed to stdout |
Constraints and Limits
| Constraint | Value | Reason |
|---|---|---|
| Bits per pixel | 3 (one per R/G/B channel) | LSB of alpha channel is left untouched to avoid transparency artefacts |
| Message terminator | <<END>> (7 bytes) |
Required for the decoder to know when the message ends |
| Output format | Lossless (PNG, BMP recommended) | Lossy compression (JPEG) destroys the hidden bits |
| Message encoding | UTF-8 | Full Unicode supported; multi-byte characters consume more capacity |