SlimCodec 0-BYTE UPLOAD · LOCAL CODEC
100% Client-Side Image · Video · Audio Compression Workbench (0-Byte Upload)
100% 本地内存编码 · 0 字节上传
← Back to Compressor ❓ FAQ

SlimCodec Image, Audio & Video Compression Methodology

SlimCodec is a 100% client-side image, video, and audio compression workbench built on browser Canvas 2D, OfflineAudioContext, CompressionStream, and MediaRecorder, executing all encoding in local memory while uploading 0 bytes to any server.

SlimCodec combines PNG 256-color Median-Cut quantization with Deflate repackaging, WebP/JPEG rate-distortion encoding, 4-bit IMA ADPCM 4:1 audio compression, and VP9/MP4 video transcoding with live PSNR (dB) and SSIM telemetry across 4 languages and localStorage state.

⚙️ 6 Core Compression & Objective Quality Modules

01 · PNG Median-Cut Palette Quantization & Floyd-Steinberg Dithering

Module 01 · PNG-8 Median-Cut & Deflate

SlimCodec scans 32-bit RGBA pixel buffers in browser memory and applies 3D Median-Cut color space partitioning to quantize true-color images into 16 to 256 indexed palette entries with Floyd-Steinberg dithering and CompressionStream Deflate, cutting PNG byte size by 55%–80% with 0 bytes uploaded.

Palette Split = argmax_{R,G,B} (MaxChannel - MinChannel) at Median Pixel Count Dither Error (x,y) = [7/16 → (x+1,y), 3/16 → (x-1,y+1), 5/16 → (x,y+1), 1/16 → (x+1,y+1)]

02 · Perceptual WebP / JPEG Encoding & 100% EXIF Metadata Stripping

Module 02 · Perceptual WebP & JPEG

SlimCodec reconstructs clean pixel buffers inside an offscreen HTML5 Canvas, automatically stripping 100% of camera EXIF, GPS coordinates, and embedded thumbnails while applying 1%–100% quality quantization and 4K/1080p/720p downscaling in under 1 second.

Output Bytes = Canvas2D.toBlob(mime="image/webp"|"image/jpeg", quality ∈ [0.01, 1.00]) Privacy Guarantee = 100% EXIF / GPS / IPTC / XMP Metadata Stripped (0 bytes leaked)

03 · Real-Time Peak Signal-to-Noise Ratio (PSNR) & SSIM Verification

Module 03 · PSNR & SSIM Telemetry

SlimCodec decodes every compressed image buffer in 10 ms and compares it pixel-by-pixel against the original RGBA array (0 bytes uploaded) to compute Mean Squared Error (MSE), Peak Signal-to-Noise Ratio (PSNR in dB), and Structural Similarity (SSIM, 0–1) for transparent quality auditing.

MSE = (1 / (3·W·H)) · Σ [(R₁-R₂)² + (G₁-G₂)² + (B₁-B₂)²] PSNR (dB) = 10 · log₁₀(255² / MSE) | SSIM = [(2μₓμᵧ+C₁)(2σₓᵧ+C₂)] / [(μₓ²+μᵧ²+C₁)(σₓ²+σᵧ²+C₂)]

04 · Audio Polyphase Downsampling & 4-Bit IMA ADPCM (0x0011) Encoding

Module 04 · 4-Bit IMA ADPCM Audio

SlimCodec resamples 48 kHz stereo audio down to 44.1 kHz, 22.05 kHz, or 16 kHz via OfflineAudioContext and encodes PCM frames into standard 4-bit IMA ADPCM WAV (RIFF format 0x0011), achieving 75%–88% audio byte reduction with 0 bytes uploaded.

ADPCM Step Index = clamp(Index + IndexTable[Nibble & 0x07], 0, 88) Compression Ratio = 16-bit PCM (176.4 KB/s) → 4-bit Mono 22.05kHz ADPCM (11.1 KB/s, -93.7% bytes)

05 · Video Resolution Scaling, FPS Capping & VP9 / MP4 Bitrate Control

Module 05 · Video Bitrate & FPS Transcoder

SlimCodec pairs HTMLCanvasElement.captureStream with hardware-accelerated MediaRecorder MP4 and WebM codecs to downscale 4K/1080p video to 720p/480p, cap frame rates at 30 fps or 24 fps, and lock target bitrates between 300 kbps and 2.5 Mbps with 0 bytes uploaded.

Target Bitrate = VideoBitsPerSecond ∈ {2500k, 1200k, 600k, 300k} + AudioBitsPerSecond (64k) Estimated Size(MB) = (TargetBitrate_kbps × Duration_seconds) / 8192

06 · Zero-Upload Memory Sandbox & Strict SHA-256 CSP Baseline

Module 06 · Zero-Upload Sandbox

SlimCodec enforces a strict default-src 'none' Content-Security-Policy with SHA-256 JSON-LD hashes over HTTPS, processing all images, audio tracks, and video streams locally via ArrayBuffer and Blob URLs with 0 bytes transmitted and preferences saved in localStorage.

Network Upload = 0 bytes (100% Client-Side ArrayBuffer & Blob URL Processing) Security Baseline = CSP default-src 'none'; script-src 'self' 'sha256-...'; X-Frame-Options: DENY

🔬 Compress Images, Audio & Video Locally in 3 Steps with SlimCodec

100% in-browser execution, zero server uploads, and real-time PSNR/SSIM and waveform verification
  1. 01 · Select Image, Audio, or Video Mode or Load Built-In Test Media

    SlimCodec lets you drag and drop local PNG/JPEG/WebP, WAV/MP3/FLAC, or MP4/WebM files in the first of 3 steps, or click "Load Built-In Sample" to synthesize high-resolution test images, stereo chord audio, or 60fps video in 1 second with 0 bytes uploaded.

  2. 02 · Configure Target Codec, Palette Depth, Sample Rate, or Bitrate

    SlimCodec provides granular controls for image quality (1%–100%), PNG palette size (16–256 colors), audio sample rate (8 kHz–48 kHz) with 4-bit IMA ADPCM encoding, and MP4 video resolution (1080p/720p/480p) with target bitrates from 300 kbps to 2.5 Mbps and 0 bytes uploaded.

  3. 03 · Inspect Byte Savings, PSNR/SSIM Metrics & Download Instantly

    SlimCodec computes exact before/after byte counts, percentage reduction (%), PSNR (dB), SSIM, and audio SNR in milliseconds, offering side-by-side visual comparison, A/B audio playback, localStorage preset persistence, and 1-click local download.