A robust steganography toolkit for hiding text or images within images, designed to survive social media platform processing.
| Tool | Hides | Pixel Modification | Survives Recompression |
|---|---|---|---|
text-image-simple.py |
Text | No | No |
text-image-advance.py |
Text | Yes (ROBUST method) | Yes |
image-to-image-simple.py |
Image | No | No |
- Hides text in file structure (no pixel changes)
- PNG: DEFLATE stream in IDAT chunk
- JPEG: Comment marker (COM segment)
- Best for: Document sharing, X.com PNG posts
- Includes simple methods plus ROBUST method
- ROBUST: Block-based luminance encoding with error correction
- Survives JPEG quality 70+ recompression
- Best for: Photo sharing on WhatsApp/Telegram
- Hides an entire image inside another image
- Compressed (zlib) + encrypted payload
- PNG: Appended to DEFLATE stream
- JPEG: Appended after EOI marker
- Best for: Document sharing only
- Encrypted payloads: PBKDF2 key derivation with XOR cipher
- Integrity verification: CRC32 checksum
- Compression: zlib compression for image-in-image
- Error correction: Hamming(7,4) code with 3x redundancy (ROBUST)
- Unicode support: Full UTF-8 including Persian, Arabic, and other scripts
- Max capacity: 500 characters (text) or limited by file size (images)
git clone git@github.com:Iman/javid-steganography.git
cd javid-steganography
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt# Hide in PNG (DEFLATE method)
python text-image-simple.py hide "Secret message" password123 input.png output.png
# Hide in JPEG (Comment marker)
python text-image-simple.py hide "Secret message" password123 input.jpg output.jpg
# Extract
python text-image-simple.py show password123 stego.png
python text-image-simple.py show password123 stego.jpg# DEFLATE method (PNG, for X.com)
python text-image-advance.py hide "Secret message" password123 input.png output.png
# ROBUST method (survives recompression)
python text-image-advance.py hide "Secret message" password123 input.jpg output.jpg robust
# Extract
python text-image-advance.py show password123 stego.png
python text-image-advance.py show password123 stego.jpg# Hide an image inside another image
python image-to-image-simple.py hide cover.jpg secret.jpg output.jpg password123
# Extract hidden image
python image-to-image-simple.py show stego.jpg extracted.jpg password123Appends encrypted data to the DEFLATE stream inside IDAT chunks. Suitable for platforms that do not re-encode PNG files meeting certain criteria (file size < width × height bytes).
Best for: X.com (Twitter), sending as documents
Uses block-based luminance encoding with error correction. Modifies pixel luminance in 8×8 blocks to encode bits, surviving JPEG recompression.
Best for: WhatsApp photos, Telegram photos, any platform with JPEG recompression
| Platform | Send Mode | Format | Tool | Method | Survives | Notes |
|---|---|---|---|---|---|---|
| X.com | Post | PNG | simple/advance | DEFLATE | Yes | filesize < width×height bytes |
| X.com | Post | JPEG | advance | ROBUST | Yes | Quality ~85 recompression |
| X.com | DM | PNG | simple/advance | DEFLATE | Yes | Same as post |
| Document | PNG | simple/advance | DEFLATE | Yes | No processing applied | |
| Document | JPEG | simple | COM | Yes | No processing applied | |
| Photo | PNG | advance | ROBUST | Yes | Converted to JPEG ~70 | |
| Photo | JPEG | advance | ROBUST | Yes | Recompressed ~70 | |
| Telegram | Document | PNG | simple/advance | DEFLATE | Yes | No processing applied |
| Telegram | Document | JPEG | simple | COM | Yes | No processing applied |
| Telegram | Photo | PNG | advance | ROBUST | Yes | Recompressed |
| Telegram | Photo | JPEG | advance | ROBUST | Yes | Quality ~82, max 2560px |
| Platform | Max Resolution | Max File Size | Compression Quality |
|---|---|---|---|
| X.com | 4096×4096 | 5MB (PNG), 5MB (JPEG) | ~85 |
| 1280×1280 (photo) | 16MB (document) | ~70 | |
| Telegram | 2560×2560 (photo) | 2GB (document) | ~82 |
| Use Case | Tool | Method | Format |
|---|---|---|---|
| X.com posts (text) | text-image-simple | DEFLATE | PNG |
| WhatsApp photo sharing (text) | text-image-advance | ROBUST | JPEG |
| WhatsApp document sharing (text) | text-image-simple | DEFLATE/COM | PNG/JPEG |
| Telegram photo sharing (text) | text-image-advance | ROBUST | JPEG |
| Telegram document sharing (text) | text-image-simple | DEFLATE/COM | PNG/JPEG |
| Hide image in image (document) | image-to-image-simple | Append | PNG/JPEG |
| Maximum text compatibility | text-image-advance | ROBUST | JPEG |
| Maximum text capacity | text-image-simple | DEFLATE | PNG |
| No pixel changes needed | text-image-simple | DEFLATE/COM | PNG/JPEG |
- Maximum 500 characters per image (text tools)
- ROBUST method requires larger images for longer messages
- DEFLATE method only works with PNG files
- Image-to-image only works when sent as document (no recompression)
- Extraction requires the same password used for embedding
- Encryption: PBKDF2-HMAC-SHA256 (100,000 iterations) + XOR cipher
- Integrity: CRC32 checksum verification
- Error correction: Hamming(7,4) encoding
- Redundancy: 3x bit replication with majority voting
- Block encoding: Centre vs edge luminance differential (strength: 25)
Step 1: Hide your message
python text-image-simple.py hide "Meet me at 5pm" mypassword photo.jpg secret_photo.jpgStep 2: Send secret_photo.jpg as a DOCUMENT (not photo) on WhatsApp/Telegram
Step 3: Recipient extracts the message
python text-image-simple.py show mypassword secret_photo.jpgOutput: Message: Meet me at 5pm
Step 1: Hide your message (uses ROBUST method)
python text-image-advance.py hide "Meet me at 5pm" mypassword photo.jpg secret_photo.jpg robustStep 2: Send secret_photo.jpg as a normal photo on WhatsApp/Telegram
Step 3: Recipient saves the photo and extracts
python text-image-advance.py show mypassword secret_photo.jpgOutput: Message: Meet me at 5pm
Step 1: Hide your message in PNG
python text-image-simple.py hide "Secret message here" mypassword photo.png secret_photo.pngStep 2: Post secret_photo.png on X.com
Step 3: Anyone with password downloads image and extracts
python text-image-simple.py show mypassword secret_photo.pngStep 1: Hide secret image inside cover image
python image-to-image-simple.py hide cover.jpg secret.jpg output.jpg mypasswordStep 2: Send output.jpg as DOCUMENT (not photo)
Step 3: Recipient extracts the hidden image
python image-to-image-simple.py show output.jpg extracted_secret.jpg mypasswordpython text-image-simple.py hide "Hello سلام 你好 مرحبا" mypassword photo.jpg secret.jpgExtract:
python text-image-simple.py show mypassword secret.jpgOutput: Message: Hello سلام 你好 مرحبا
| Mistake | Problem | Solution |
|---|---|---|
| Sending as photo with simple tool | Data destroyed by recompression | Use text-image-advance.py with robust flag |
| Wrong password | Extraction fails | Use exact same password |
| Forgetting file extension | Wrong format used | Always include .jpg or .png |
| Message too long | Embedding fails | Keep under 500 characters |
| Image too small for ROBUST | Not enough capacity | Use larger cover image |
Do you need to send as PHOTO (not document)?
├── YES → Use text-image-advance.py with "robust" flag
└── NO (sending as document) → Use text-image-simple.py
Are you hiding an image (not text)?
├── YES → Use image-to-image-simple.py (document only)
└── NO → Use text tools above
MIT License