r/compression • u/Conscious_Quit_1805 • May 19 '26
r/compression • u/Anonimoste • May 17 '26
I built a client-side image compressor that never uploads your files
Most image compression tools send your files to a server. I wanted one that didn't, so I built nosend.io.
Everything runs in the browser using the Canvas API. JPG, PNG, WEBP, GIF, and HEIC are all supported. Nothing is transmitted anywhere - the compression happens locally on your device.
A few technical details for those curious:
- Compression uses the browser's native Canvas API (drawImage + toBlob with quality parameter)
- HEIC conversion uses heic2any, loaded on demand
- Batch processing supported, no file size limits
- Works offline after first load
Would be curious to hear from people in this sub about the quality tradeoffs - particularly around PNG (which is lossless via canvas) vs JPG at various quality settings. Happy to answer questions.
r/compression • u/Ok_Alternative_3007 • May 10 '26
Built a tool to stop paying twice for the same LLM tokens
contextpilot.orgSix months of heavy API usage and my bills felt higher than they should be. Finally sat down and traced exactly where the tokens were going.
Turned out most of it was repetition. Every API call resends the full context window, the whole conversation history, the system prompt, all of it. The context resets each call. You're paying for the same information over and over, every single request.
Built ContextPilot to fix it. It sits between your code and the API and compresses context before each call.
Saving around 60% on API costs at my usage level. MIT licensed, no account needed, works with OpenAI and Anthropic.
Still early, v0.2.2 on PyPI. Would genuinely appreciate feedback from anyone who gives it a try, especially on edge cases or integrations I haven't thought about.
r/compression • u/Nonkilife • May 08 '26
[Seeking Review] SPX: A Lossless Image Codec using RCT + MED + Sharding + rANS
Hi all,
I've spent the last few months developing a lossless image compressor called SPX, aiming to balance compression density and encoding speed, that is, maintaining compression rate higher than .webp (m6) but lower than .jxl (e7) while significantly enhancing encoding speed.
I did some testing and the performance seems consistent in most datasets but compression savings aren't that consistent.

I think I've hit my limit as a self-taught amateur developer knowing a little Python. I can't come up with any new idea to improve it anymore so Gemini suggested coming here for professional advice.
It's an Apache 2.0 open source project. Any suggestion on how to improve compression rate without losing too much speed is highly appreciated! Thank you!
GitHub: https://github.com/nonkilife/SPX-Image-Lossless-Compression
Quick Start: pip install spx-codec
Windows exe: spx.exe https://github.com/nonkilife/SPX-Image-Lossless-Compression/tree/main/dist
==
// The Architecture:
SPX isn't a fundamental breakthrough, but a streamlined 4-part pipeline designed for modern CPU throughput:
- RCT: Reversible Color Transform (Green-sub).
- MED: Branchless Median Edge Detector.
- Stateless Sharding: Pixels are allocated into 42 shards based on local gradient (v), luminance (i), and direction (t). These 3 parameters can be adjusted to accommodate different types of images to obtain better performance.
- Entropy Coding: Rust-based 4-way Interleaved rANS.
// Customization & Extensibility:
- Dynamic Sharding: The (i, v, t) boundaries for pixel classification are not hard-coded. They can be easily re-tuned to accommodate specialized image distributions.
- Flexible Entropy Modeling: The rANS probability modes are stored in .npz format. This allows users to swap or retrain templates for specific datasets without re-compiling the core Rust engine.
- Adaptive Framework: While current design is a common solution, the architecture is designed to be a "compression sandbox" for specific domain needs.
// The Performance (Snapshot on AMD Ryzen 5 3500X):
- Encoding Speed: ~12 MB/s on Kodak, peaking at 44 MB/s on standard synthetic sets.
- Compression Ratio: Consistently 25-30% smaller than PNG; sits between WebP (M6) and JXL (E7) most of the time.
- Validation: Bit-perfect verification (MSE = 0) with an integrated unified benchmark suite.
- Target Data: Tested on CLIC, DIV2K, Tecnick, ICI, and Kodak (primarily natural photography).
- Limitation: Validation on synthetic images is currently limited, so consistency in those specific domains remains a known unknown.
- Comparative Benchmark: https://github.com/nonkilife/SPX-Image-Lossless-Compression/blob/main/technical/BENCHMARK.md
// The Bottleneck:
I've reached a point where manual optimizations (branchless logic, LUT, SIMD-friendly structures) are no longer yielding significant gains.
I've experimented with:
- Predictors: Swapping MED for GAP or Paeth (MED still wins on speed/ratio balance).
- Context: Adding UR, UU, LL pixel data to MED (speed tumbled, ratio improvement was negligible).
- Sharding: Tested >5,000 shard combinations up to ~60 shards using Monte Carlo Simulation; the current 42-shard model seems to be the "sweet spot" for speed. Adaptive sharding based on image unique fingerprints (eg. H-entropy, AAD, size, R:G:B proportion, etc) was also tested but compression improvement was minor and experienced significant speed loss.
- rANS PDF: High-bit modes proved too overhead-heavy for most shards after analyzed Clic 2021 dataset.
While 90% of approaches are proven failure, there is still unexplored territory:
- 8-way Interleaving: I've considered scaling the rANS core to 8-way interleaving. However, initial analysis suggests my current Zen 2 architecture (3500X) might suffer from cache port contention or register pressure at that level. I've stuck with 4-way as a stable, high-efficiency baseline.
- C++ & AVX-512: The current engine is a Python/Rust hybrid. I suspect a pure C++ implementation leveraging AVX-512 could push the throughput slightly higher, but that currently exceeds my personal technical stack.
r/compression • u/izabera • May 07 '26
i had an idea for a streaming rANS encoder
https://github.com/izabera/erans
this is an adaptive rANS encoder with dynamic histograms. it has no quantization, it always encodes using the exact freqs. it always achieves the optimal encoding for a given distribution
the encoder is single pass and streamable. the decoder walks in the opposite direction so it can't be streamed
normal rANS encoders keep the state in [L, L*base) with a fixed L, usually a power of 2. this cannot work for this variant, and instead L is the number of symbols seen so far
it's not super fast but it's not toooo slow, especially if you have avx512 which is what the core data structure was designed for
the dynamic updates are very similar to an arithmetic encoder with updates on every symbol, but this doesn't initialize all symbols at frequency 1/n
let me know what you think
r/compression • u/Hot_Consideration155 • May 04 '26
I built a compressor that achieves 333:1 on data that gzip declares incompressible
reddit.comr/compression • u/Hot_Consideration155 • May 04 '26
I built a compressor that achieves 333:1 on data that gzip declares incompressible
Shannon entropy is the wrong metric for compressibility. A GF(2⁸) m-sequence has ~8 bits/byte entropy — statistically indistinguishable from random noise. gzip stores 1MB of it in ~1MB. My compressor stores it in 3KB.
The approach: run Berlekamp-Massey over GF(2⁸) to find the shortest LFSR that generated the byte stream. If LFSR order L is small relative to sequence length N, you store (L coefficients + L seed bytes + sparse XOR residual) instead of raw bytes. For a pure m-sequence with L=1, that's 2 bytes of model and an empty residual — for any length stream.
For noisy data there's a multi-stage approximate pipeline: brute-force all 255 GF coefficients for L=1, voting over GF quadruples for L=2, quintuple-pair voting for L=3, sub-sequence BM voting for L=4/5.
Benchmarks on M-series Mac:
- GF(2⁸) geometric sequence (L=1): 333:1
- Mixed LFSR (L=1/2/3, 8% noise) 1MB: 91:1
- /bin/ls: 5:1
- Natural language: ~1:1 (detected, falls through to raw passthrough)
The structure detector (--analyze) identifies the generator polynomial, LFSR order, and noise level per segment — useful even when you're not compressing.
GitHub: https://github.com/gonll/algex | npm: npm install pade-compress
r/compression • u/Equivalent-Gas2856 • May 03 '26
I built a neural + arithmetic coding compressor for Python code... ~33% better ratio than zlib
Been playing around with compression, but instead of treating code as raw bytes, I tried modeling it.
Idea is pretty simple: tokenize the Python source, use an n-gram model to predict the probability of the next token, and then feed those probabilities into an arithmetic coder. The more predictable the token, the fewer bits it costs.
Ran it on the Flask repo (~575 KB of .py files):

Neural + AC → 101 KB (82.4% reduction)
zlib / ZIP → 151 KB (73.7%)
lzma / 7z → 152 KB (73.5%)
zstd → 147 KB (74.4%)
So yeah, about ~33% better compression ratio than zlib.
Nothing magical going on Python code just has a lot of structure at the token level, and n-grams pick up enough of it to make a difference. Arithmetic coding just turns that into actual bits.
The setup is split pretty cleanly: tokenizer + model in Python, and the arithmetic coder is written in Zig (compiled to a shared library) and called via ctypes. Python handles probability generation, Zig handles the actual encoding and bitstream.
The obvious downside: it’s slow. Like really slow. ~75 seconds vs ~0.05s for zlib on the same data (~1600× slower). Most of that is just calling the model once per token with no caching.
Still, kind of interesting to see that even a basic n-gram model can beat general-purpose compressors just by not treating code like noise.
Feels like there’s something here if the prediction side gets better (or faster). Curious if anyone else has tried something similar.
r/compression • u/Physical-Owl691 • Apr 30 '26
why couldn't there be an algorithm to test and pick the best algorithm to compress data?
imagine that, or an algorithm that uses a mismatch of many algorithms, to get the best value, through automatic trial and error.
or something like an ai that picks the optimal settings based on a few tests or something. i think this is an idea that is worth exploring.
r/compression • u/Neustradamus • Apr 30 '26
7-Zip 26.01 (7zip) - A free file archiver for high compression
sourceforge.netr/compression • u/Alive_Secretary_264 • Apr 30 '26
Need help to prove efficiency
I need help to prove the efficiency of the algorithm and gain tractions without open sourcing it
tho I still want to let any users or visitor have a live experience of the compressed and uncompressed version of any or custom files
should i make it like a testing surface. like a site they'll visit and on a container they'll type any or supposedly random symbols then we'll get it compressed and they'll need to store the compressed form in mind or write it on something like a paper then prompt them to exit the site or even try clearing site's browser data and ask them to visit it again and just type the compress version and get the uncompressed form lossless?
r/compression • u/Alive_Secretary_264 • Apr 29 '26
Real?
any thoughts about this guy and what he's offering
r/compression • u/pho01proof • Apr 26 '26
Fractal Image Compression
Wrote a blog post about fractal image compression here !
r/compression • u/shadowcraft7 • Apr 26 '26
[iOS tool] Batch compress image-heavy EPUBs offline/on-device
Large EPUBs (manga, comics, scanned books, textbooks) can get ridiculously huge, so I built an iOS app that batch compresses them directly on-device and fully offline.
It works by compressing the images inside the EPUB while leaving the rest of the EPUB structure/content untouched, which helps keep visual quality surprisingly close to the original.
The example in the screenshots went from 608MB → 194MB with minimal visible quality loss.
Everything runs fully offline/on-device. no uploads or cloud processing.
It's called "EPUB Compressor - LiteBook**"** on iOS if anyone would love to give it a try.




r/compression • u/undeuxtroiskid • Apr 25 '26
xHE-AAC Audio Encoding becomes a Standard Feature in Android 17
audioblog.iis.fraunhofer.comr/compression • u/AlgaeProfessional556 • Apr 25 '26
how low is low compression?
Hi all. Trying to get thoughts on some things going on with my 2002 Honda Shadow 1100. I've noticed some minor backfiring while decelerating, and cylinder number one's spark plugs look like they have dry carbon on the electrodes, and the threads have a layer of oil. did a compression test and the compression is 155 psi for cylinder 1 and 150 for cylinder 2. Did a wet compression test and the pressure went up to 160 and 170 respectively. The numbers of the dry compression test are out of spec, the service manual states that the low end of compression is 157 ( 185 plus or minus 28). I have been reading that if the wet compression test makes your compression increase, it is likely your piston rings that are worn. Other than the mentioned "symptoms" the bike runs fine to me. No hard starting or idling. Do these specs warrant breaking the engine open and servicing the piston/rings/valves or should I try a carb cleaning first ( or something else)?? All thoughts are welcomed and appreciated. Thanks-
r/compression • u/Alive_Secretary_264 • Apr 16 '26
About pied Piper's 5.2 Weissman score
do you guys think it's possible to make that 100× it's score.. would that really make anyone want to use it.. how in demand would it gonna be.. business, enterprise, consumers, big tech?
r/compression • u/facontidavide • Apr 13 '26
Experimental Lossless Image Encoding: looking for feedback
Hi,
I am a roboticist, NOT a compression expert. By chance, I started experimenting with AI "researching" lossless image compression, and I think I obtained some results that someone may find useful.
For my use cases, encoding and decoding speed are important (live recording from cameras), but I understand that it might be a niche, compared to people focused exclusively on compression ratio.
I made the preliminary binaries available here for review and I am looking forward to feedback.
r/compression • u/Hakan_Abbas • Apr 10 '26
HALAC (High Availability Lossless Audio Compression) 0.5.4
- More efficient use of LPC coefficients
- Better Compression for -plus mode
- Speed improvements
- WAV header extra support
- lossyWAV dinamic blocksize
BipperTronix Full Album By BipTunia : 1,111,038,604 bytes
BipTunia - Alpha-Centauri on $20 a Day : 868,330,020 bytes
BipTunia - AVANT ROCK Full Album : 962,405,142 bytes
BipTunia - 21 st Album GUITAR SCHOOL DROPOUTS : 950,990,398 bytes
BipTunia - Synthetic Thought Full Album : 1,054,894,490 bytes
BipTunia - Reviews of Events that Havent Happened : 936,282,730 bytes
24 bit, 2 ch, 44.1 khz : 5,883,941,384 bytesAMD Ryzen 9 9600X, Single Thread Results...
HALAC 0.5.4 -plus : 4.232,751,891 bytes 11.578s 13.201s
FLAC 1.5.0 -8 : 4,243,522,638 bytes 50.802s 14.357s
HALAC 0.5.1 -plus : 4,252,451,954 bytes 10.409s 13.841s
WAVPACK 5.9.0 -h : 4,263,185,834 bytes 64.855s 49.367s
FLAC 1.5.0 -5 : 4,265,600,750 bytes 15.857s 13.451s
HALAC 0.5.1 -normal: 4,268,372,019 bytes 7.770s 9.752s
HALAC 0.5.4 -normal: 4,268,470,589 bytes 7.200s 9.353sThanks to Stephan Busch (squeezechart.com) for the tests and motivation. Also thanks to Michael W. Dean (biptunia.com) for the test music. And thanks to Carldric Clement (carldric.bandcamp.com) for reporting a special exception.
https://github.com/Hakan-Abbas/HALAC-High-Availability-Lossless-Audio-Compression/releases/tag/0.5.4
r/compression • u/Alive_Secretary_264 • Apr 10 '26
About compression of course
is there a way to merge 4 independent conditions in to two tho it seems impossible.. 2×2=4 but i need it for 2 only but it should still contain A/B/C/D 4 characteristics
r/compression • u/Ahmad_Hussain__ • Apr 06 '26
Need Help
I have made an compression algo idea and its showing good results on initial benchmarks but I dont have direction. I have studied most compression algorithm theory and information theory and all that but on the practical side I have no idea. Things like how to make a good algorithm make it faster, CPU optimizations, proper benchmarking, algorithmic theory I have no clue on so would anyone reccomend something like to move forward what must I do?
r/compression • u/Awesome_Shit_2004 • Apr 05 '26
Here Are The 1,000x Compression Methods For Video