Bitmap to BPG Converter
Convert BMP, PNG, JPG images to BPG format with DCT-based HEVC intra compression. Adjust quality, chroma subsampling, and bit depth.
Drop image here or click to browse
BMP, PNG, JPG, WebP • Max 50 MB
About
BPG (Better Portable Graphics) is a lossy and lossless image format created by Fabrice Bellard. It uses a subset of HEVC (H.265) intra-frame coding to achieve compression ratios roughly 40% better than JPEG at equivalent perceptual quality. Misconfiguring the quantization parameter QP leads to either bloated files or destructive artifact banding - particularly in smooth gradients and skin tones. This tool performs real DCT-based transform coding with quantization on your image data, packages the result into a valid BPG container with correct magic bytes (0x42504746FB), and lets you control quality, chroma subsampling, and bit depth. Processing runs entirely in your browser via a Web Worker; no data leaves your machine.
Note: this implementation uses a simplified HEVC-like intra pipeline (DC and planar prediction with 8Γ8 DCT). It approximates the reference bpgenc output but does not implement the full HEVC specification (no rate-distortion optimization, no SAO filtering). For archival or professional grading, use Bellard's reference encoder. For quick web previews, size comparisons, and format exploration, this converter is accurate and functional.
Formulas
The core compression uses the Type-II Discrete Cosine Transform on 8Γ8 pixel blocks, identical to the foundation of HEVC intra coding:
where f(x, y) is the pixel value at position (x, y) within the block, F(u, v) is the DCT coefficient, and C(k) = 1β2 for k = 0, otherwise C(k) = 1.
Quantization divides each coefficient by a step size derived from QP:
where QP = 0 yields Qstep = 1 (lossless) and QP = 51 yields Qstep = 255 (maximum compression). RGB to YCbCr conversion uses BT.601 coefficients:
Reference Data
| Parameter | Range | Default | Effect |
|---|---|---|---|
| Quality (QP) | 0 - 51 | 28 | Lower = higher quality, larger file |
| Chroma Format | 4:2:0, 4:2:2, 4:4:4 | 4:2:0 | 4:4:4 preserves color detail |
| Bit Depth | 8, 10 | 8 | 10-bit reduces banding in gradients |
| Color Space | YCbCr, RGB | YCbCr | YCbCr exploits human vision model |
| Max Dimension | 16384 px | - | BPG spec limit per axis |
| BPG Magic Bytes | 0x42 0x50 0x47 0xFB | ||
| JPEG Quality 80 | ~2.0 bpp typical | ||
| BPG QP 28 | ~1.2 bpp typical | ||
| BPG QP 20 | ~2.5 bpp (near-lossless) | ||
| BPG QP 40 | ~0.4 bpp (aggressive) | ||
| DCT Block Size | 8Γ8 (this implementation) | ||
| HEVC CTU Size (ref) | 64Γ64 max | ||
| Lossless Mode | QP = 0 (quantizer step 1) | ||
| Input Formats | BMP, PNG, JPG, WebP, GIF (first frame) | ||
| HEVC Profile | Main (8-bit) / Main 10 (10-bit) | ||
| Container | BPG v1 (Bellard spec) | ||
| Compression Gain vs JPEG | ~30 - 50% smaller at same SSIM | ||
| Browser Decoding | Requires bpg.js decoder | ||
| Alpha Channel | Supported in BPG spec (not this build) | ||
| Animation | Supported in BPG spec (not this build) | ||
| EXIF Metadata | Stripped during conversion | ||