AgentSkillsCN

stegano-lsb-steganography

利用 LSB(最低有效位)隐写术,在 PNG 图像中隐藏并提取秘密文本消息。适用于嵌入隐形水印、在图像中隐藏文本载荷,或从隐写图像中提取先前隐藏的消息。

SKILL.md
--- frontmatter
name: stegano-lsb-steganography
description: Hide and extract secret text messages within PNG images using LSB (Least Significant Bit) steganography. Use when embedding invisible watermarks, hiding text payloads in images, or extracting previously hidden messages from steganographic images.

Stegano: LSB Image Steganography

Overview

Stegano is a pure-Python steganography library that hides text data inside PNG images by modifying the least significant bits of pixel values. The changes are imperceptible to the human eye, making it useful for watermarking, covert communication, and data embedding.

Quick Start

Embed a message:

bash
python scripts/embed_watermark.py --input image.png --output watermarked.png --watermark "secret message"

Extract a message:

bash
python scripts/extract_watermark.py --input watermarked.png --output message.txt

Scripts

scripts/embed_watermark.py

Embed a text watermark into a PNG image using LSB encoding.

bash
python scripts/embed_watermark.py --input <image.png> --output <output.png> --watermark <text>

Parameters:

  • --input — Source PNG image path
  • --output — Output watermarked PNG path
  • --watermark — Text message to embed

scripts/extract_watermark.py

Extract a hidden text message from a steganographic PNG image.

bash
python scripts/extract_watermark.py --input <watermarked.png> --output <message.txt>

Parameters:

  • --input — Watermarked PNG image path
  • --output — Output text file path

scripts/embed_hidden_text.py

Embed a predefined "hidden_text" watermark into an image.

bash
python scripts/embed_hidden_text.py --input <image.png> --output <output.png>

Important Notes

  • PNG only — JPEG compression destroys LSB data; always use PNG format
  • Capacity — Maximum message length depends on image dimensions (width × height bits available)
  • Dependency — Requires stegano package (pip install stegano)