Urgent.News

What's breaking now, across thousands of outlets.

Tech

I Wrote a Rust Image Compressor That Survives WeChat's Brutal Re-Compression

I Wrote a Rust Image Compressor That Survives WeChat's Brutal Re-Compression If you've ever sent a photo through WeChat and watched it come out looking like it went through a blender, you know the feeling. The colors shift, gradients turn into visible banding, and fine detail just evaporates. Instagram and WhatsApp do the same thing, just with different thresholds. I got annoyed enough to…

Abstract editorial illustration

A Rust image compressor was developed to counter the damaging effects of platforms like WeChat's brutal re-compression on photos. The problem with compression lies beyond just file size reduction; it involves downscaling, chroma subsampling, and low-quality re-encoding. These processes lead to color shifts, banding, and loss of detail.

After investigating this issue, the author built a tool that utilizes MozJPEG and keeps full 4:4:4 chroma to counteract these effects. The tool exposes a clean JSON interface for AI agents to interact directly with it.

The WeChat, Xiaohongshu (RED), and Instagram platforms use three distinct processes when compressing images: downscaling, chroma subsampling, and low-quality re-encoding. The author's approach involves keeping 4:4:4 chroma, starting with a quality of Q96, and applying contrast-adaptive sharpening to maintain natural image clarity.

Furthermore, the tool offers preset configurations for each platform to ensure optimal results. The compressor is written in Rust, making it fast, memory-safe, and single-file, requiring no installation or dependencies.

The author highlights the importance of preserving 4:4:4 chroma, using a high-quality encoding (Q96), and applying a contrast-adaptive sharpening technique to maintain image clarity. The JSON-based API allows AI agents to interact with the tool without learning complex command-line flags. The final product boasts impressive benchmarks, including an average per-image processing time of 89ms and a distributable size of only 4.5MB.

Overall, this Rust-based compressor effectively addresses the challenges posed by re-compression on platforms like WeChat, ensuring that images maintain their quality and original appearance.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

MCP went stateless. Your agent workflow did not.

MCP 2026-07-28 is now the stable Model Context Protocol revision. Its biggest architectural change is a stateless, sessionless core designed to run more naturally on ordinary HTTP infrastructure. That is a major improvement for protocol implementers. It does not make the work performed through MCP stateless.

More from Monday 3 August →