Skip to main content

Module optimizer

Module optimizer 

Source
Expand description

Cover image preprocessing optimizer for steganographic embedding.

Subtly modifies raw pixels before JPEG compression to improve embedding quality and capacity. Each mode applies a different pipeline:

  • Ghost: Texture-adaptive 4-stage pipeline (noise injection, micro-contrast, unsharp mask, smooth-region dithering) — maximizes non-zero AC coefficients. Each stage adapts its strength based on existing texture levels to avoid degrading already-optimized images.
  • Armor: Light pipeline (block-boundary smoothing, DC stabilization) — reduces cross-block discontinuities for STDM robustness.
  • Fortress: Minimal (block-boundary smoothing only) — stabilizes DC averages for BA-QIM embedding.

“Do no harm” guarantee: After optimization, the average absolute gradient (a proxy for JPEG AC energy / stego capacity) is compared to the original. If the optimizer reduced gradient energy, the original pixels are returned unchanged. This prevents degradation of pre-optimized images (e.g. images that already had noise, micro-contrast, and sharpening applied in Photoshop).

The optimizer is deterministic: given the same pixels, dimensions, config, and seed, it always produces the same output.

Structs§

OptimizerConfig
Configuration for the cover image optimizer.

Enums§

OptimizerMode
Which optimization pipeline to run.

Functions§

optimize_cover
Optimize raw RGB pixels for steganographic embedding.