User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times

Drop image here or click to browse

BMP, PNG, JPG, WebP • Max 50 MB

Is this tool helpful?

Your feedback helps us improve.

β˜… β˜… β˜… β˜… β˜…

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.

bpg converter bitmap to bpg image compression hevc better portable graphics bpg encoder image converter

Formulas

The core compression uses the Type-II Discrete Cosine Transform on 8Γ—8 pixel blocks, identical to the foundation of HEVC intra coding:

F(u, v) = 14 C(u) C(v) 7βˆ‘x=0 7βˆ‘y=0 f(x, y) cos (2x + 1)uΟ€16 cos (2y + 1)vΟ€16

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:

Qstep = 1 + QP Γ— 25451

where QP = 0 yields Qstep = 1 (lossless) and QP = 51 yields Qstep = 255 (maximum compression). RGB to YCbCr conversion uses BT.601 coefficients:

Y = 0.299R + 0.587G + 0.114B

Reference Data

ParameterRangeDefaultEffect
Quality (QP)0 - 5128Lower = higher quality, larger file
Chroma Format4:2:0, 4:2:2, 4:4:44:2:04:4:4 preserves color detail
Bit Depth8, 10810-bit reduces banding in gradients
Color SpaceYCbCr, RGBYCbCrYCbCr exploits human vision model
Max Dimension16384 px - BPG spec limit per axis
BPG Magic Bytes0x42 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 Size8Γ—8 (this implementation)
HEVC CTU Size (ref)64Γ—64 max
Lossless ModeQP = 0 (quantizer step 1)
Input FormatsBMP, PNG, JPG, WebP, GIF (first frame)
HEVC ProfileMain (8-bit) / Main 10 (10-bit)
ContainerBPG v1 (Bellard spec)
Compression Gain vs JPEG~30 - 50% smaller at same SSIM
Browser DecodingRequires bpg.js decoder
Alpha ChannelSupported in BPG spec (not this build)
AnimationSupported in BPG spec (not this build)
EXIF MetadataStripped during conversion

Frequently Asked Questions

BPG files can be viewed with Fabrice Bellard's bpgview reference decoder, IrfanView (with plugin), XnView, and any web page embedding the bpg.js JavaScript decoder. Major browsers do not natively support BPG. The format stores pixel data as HEVC intra frames, so any HEVC decoder can theoretically extract the image data if you strip the BPG container header.
QP (Quantization Parameter) controls the DCT coefficient quantization step. At QP = 0, the step is 1 (no information lost, lossless). At QP = 28 (default), you typically get 40-50% smaller files than JPEG quality 80 at comparable SSIM scores. At QP = 40+, blocking artifacts become visible in smooth gradients. For photographic content, QP 24-32 is the practical sweet spot. For text/line art, use QP 10-18 to preserve sharp edges.
4:2:0 discards 75% of chroma resolution, which is imperceptible in most photographs due to human vision's lower chromatic spatial frequency sensitivity. However, for images with saturated color edges (red text on blue background, color charts, UI screenshots), 4:2:0 causes visible color bleeding. Use 4:4:4 for graphics, screenshots, and medical imaging. Use 4:2:0 for photographs to achieve ~30% smaller files.
The BPG specification supports alpha channels as a separate HEVC-encoded plane. This implementation converts the image via Canvas which composites transparency onto a white background. If your source image has transparency, it will be flattened. For alpha-preserving conversion, use the reference bpgenc command-line tool.
8-bit encoding quantizes each channel to 256 levels. In smooth gradients (sky, skin), after DCT quantization the reconstructed values may cluster into visible steps. 10-bit provides 1024 levels per channel, giving 4x finer granularity. After lossy compression at the same QP, 10-bit retains smoother transitions. The file size increase is typically 10-15%, but perceptual quality in gradient-heavy images improves measurably (SSIM gains of 0.01-0.03 at equivalent QP).
This implementation uses a simplified pipeline: fixed 8Γ—8 DCT blocks (vs HEVC's 4Γ—4 to 64Γ—64 adaptive CTUs), DC prediction only (vs 35 angular intra modes), no in-loop deblocking or SAO filters, no CABAC entropy coding (uses run-length + variable-length coding). The result is a valid BPG file but with approximately 20-40% larger file sizes than the reference encoder at equivalent visual quality. For production workflows, use bpgenc. For exploration and quick conversions, this tool is practical.