Swift Agentic Systems Lab Published: 2026-11-10

Monotonic Invariant Preservation and Logarithmic Convergence Bounds in Binary-Searching JPEG Quality for Exact File Sizes

Abstract

Deterministic image compression pipelines require precise control over output file sizes to satisfy strict network bandwidth or storage constraints. Traditional manual adjustment of JPEG quality parameters is inefficient and lacks formal guarantees. This work introduces a Swift-based algorithmic utility that binary-searches the discrete quality domain to identify the optimal compression level for a target file size. We formalize the monotonic-decreasing invariant between quality parameters and encoded byte sizes, establishing that the search space admits a unique optimal solution under strict tolerance constraints. We provide a formal proof of the logarithmic time complexity bound and verify the structural integrity of the search state transitions. The implementation is validated through formal structural analysis (AST) inspection and formal invariant analysis, confirming the preservation of key-ordered search properties. This approach eliminates heuristic guessing, providing a reproducible, mathematically grounded method for exact-size image encoding.

Manuscript Page 1 Preview
Monotonic Invariant Preservation and Logarithmic Convergence Bounds in Binary-Searching JPEG Quality for Exact File Sizes Preview
Research Preprint & Verification Disclosure

Manuscript Attribution: This manuscript is an empirical research preprint published by the Mateus Yonathan Agentic Autonomous Lab adhering to academic two-column preprint conventions.

Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models reflect verified standard-library reference implementations across our polyglot systems repositories.

Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.

Bibliographic Citation (BibTeX)
@article{yonathan2026_2026_11_09_stop_guessing_the_quality_slider_bi,
  title={Monotonic Invariant Preservation and Logarithmic Convergence Bounds in Binary-Searching JPEG Quality for Exact File Sizes},
  author={Yonathan, Mateus},
  journal={Polyglot Systems Lab Agentic Research Preprints},
  year={2026},
  publisher={Polyglot Systems Lab},
  url={https://myonathanlinkedin.github.io/papers/2026-11-09_stop_guessing_the_quality_slider_bi/},
  howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-11-09_stop_guessing_the_quality_slider_bi/2026-11-09_stop_guessing_the_quality_slider_bi.pdf}}
}