hn.today

CMNT: A 3-arY Combinatorial tree image codec outperforms PNG on continuous art

github.com4 points0 comments
Screenshot of CMNT: A 3-arY Combinatorial tree image codec outperforms PNG on continuous art

CMNT is a lossless image codec and Python toolset that aims to reduce file sizes by combining reversible color decorrelation, adaptive spatial prediction, and a ternary prefix tree. It transforms RGB into a luminance-like channel and two color-difference channels, predicts pixels from nearby values, then encodes the prediction residuals as ternary symbols. Groups of five trits are packed into one byte, and the result is stored in a native .cmnt file. The project says decoding reproduces every pixel exactly, with round-trip verification using matching SHA-256 hashes. It also offers a compact near-lossless mode using quantization, plus command-line conversion and a Windows desktop viewer.

Benchmarks cover five examples: 3D art, digital art, a phone screenshot, CGI, and a photograph. With the optional MANIAC context-modeling stage, CMNT files are 6.9%-29.7% smaller than standard PNG files across those examples. The base CMNT results are mixed: they beat PNG on two samples but produce larger files on three. Google WebP Lossless is smaller than even the MANIAC-enhanced CMNT files in every listed comparison, so the demonstrated advantage is specifically over PNG, not the strongest tested alternative. The repository also claims the near-lossless mode can reach JPEG-like sizes without 8×8 blocking artifacts, and includes installation instructions, automated tests, and an MIT license.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.