-
Notifications
You must be signed in to change notification settings - Fork 0
Capacity Calculator
Understanding how much data you can hide in an image is crucial for successful steganography. This guide explains capacity calculation and helps you choose the right cover image.
| Image Resolution | Approximate Capacity |
|---|---|
| 640 × 480 (VGA) | ~230 KB |
| 1280 × 720 (HD) | ~691 KB |
| 1920 × 1080 (Full HD) | ~1.48 MB |
| 2560 × 1440 (2K) | ~2.76 MB |
| 3840 × 2160 (4K) | ~6.22 MB |
| 4000 × 3000 (12MP) | ~9 MB |
| 6000 × 4000 (24MP) | ~18 MB |
Note: These are theoretical maximums with 2 bits per channel. Actual usable capacity is ~500 bytes less due to encryption overhead.
Raw Capacity (bits) = Width × Height × Channels × Bits_Per_Channel
Raw Capacity (bytes) = Raw Capacity (bits) / 8
Usable Capacity = Raw Capacity - Header (74 bytes) - Kyber Ciphertext (1568 bytes) - Auth Tag (16 bytes)
Usable Capacity ≈ Raw Capacity - 1,658 bytes
Image: 1920 × 1080
Raw Capacity: 1920 × 1080 × 3 × 2 / 8 = 1,555,200 bytes (1.48 MB)
Usable: 1,555,200 - 1,658 = 1,553,542 bytes (1.48 MB)
PDF Size: 500 KB = 512,000 bytes
✅ YES - 512 KB << 1.48 MB (plenty of room!)
Image: 1280 × 720
Raw Capacity: 1280 × 720 × 3 × 2 / 8 = 691,200 bytes (675 KB)
Usable: 691,200 - 1,658 = 689,542 bytes (673 KB)
File Size: 2 MB = 2,097,152 bytes
❌ NO - 2 MB >> 673 KB
Solution: Use a larger image (4K) or Split Encoding
Required: 5 MB = 5,242,880 bytes
With overhead: 5,242,880 + 1,658 = 5,244,538 bytes
Bits needed: 5,244,538 × 8 = 41,956,304 bits
Pixels needed: 41,956,304 / (3 channels × 2 bits) = 6,992,717 pixels
√6,992,717 ≈ 2,644
Minimum image: ~2644 × 2644 pixels
Recommended: 3000 × 3000 or larger (for safety margin)
QuantHide uses 2 bits per channel by default, balancing capacity and invisibility:
| Bits/Channel | Capacity | Visibility | Use Case |
|---|---|---|---|
| 1 bit | 50% | Invisible | Maximum stealth |
| 2 bits | 100% | Barely visible | Default |
| 4 bits | 200% | Noticeable | Maximum capacity |
1 bit: Changes 0-1 in color value (e.g., 128 → 129)
2 bits: Changes 0-3 in color value (e.g., 128 → 131)
4 bits: Changes 0-15 in color value (e.g., 128 → 143)
| File Type | Typical Size | Minimum Image |
|---|---|---|
| Text message | < 1 KB | Any (even 100×100) |
| Word document | 50-500 KB | 720p |
| PDF (few pages) | 100 KB - 1 MB | 1080p |
| Small image | 500 KB - 2 MB | 2K |
| MP3 song | 3-5 MB | 4K |
| Short video | 10+ MB | Split across multiple images |
Best choices:
- 📸 High-resolution photos (12MP+)
- 🏞️ Nature/landscape photos (complex textures)
- 👥 Group photos (lots of detail)
Avoid:
- ❌ Screenshots (flat colors)
- ❌ Logos/graphics (simple shapes)
- ❌ Already compressed images
-
Use a larger cover image
- Find a higher resolution photo
- Use stock photo sites for large images
-
Compress your data first
- ZIP files before embedding
- Use efficient formats (JPEG for images, etc.)
-
Use Split Encoding
- Distribute across multiple images
- Each part is independently encrypted
For developers, here's the calculation logic:
function calculateCapacity(width, height, bitsPerChannel = 2) {
const channels = 3; // RGB
const overhead = 1658; // Header + Kyber + Auth tag
const rawBits = width * height * channels * bitsPerChannel;
const rawBytes = Math.floor(rawBits / 8);
const usableBytes = rawBytes - overhead;
return {
rawBytes,
usableBytes,
usableKB: (usableBytes / 1024).toFixed(2),
usableMB: (usableBytes / (1024 * 1024)).toFixed(2)
};
}
// Example
const cap = calculateCapacity(1920, 1080);
console.log(`Usable capacity: ${cap.usableMB} MB`);
// Output: Usable capacity: 1.48 MBWhen you load an image in QuantHide, the info panel shows:
Size: 1920 × 1280
Format: PNG
Capacity: 1.8 MB
This "Capacity" value is the usable space for your data.
The encryption adds overhead:
- 74 bytes for header
- 1,568 bytes for Kyber ciphertext
- 16 bytes for authentication tag
- Plus random padding
The source format doesn't matter - QuantHide converts everything internally. The output is always PNG to preserve the hidden data.
Using 4 bits per channel doubles capacity but may create visible artifacts. Not recommended for sensitive applications.