Better Portable Graphicsimage format
image/x-bpg
Magic Bytes
Offset: 0
42 50 47 FB
Better Portable Graphics (BPG) is a raster image format created by programmer Fabrice Bellard based on a subset of the High Efficiency Video Coding (HEVC) standard. Designed as a high-efficiency alternative to JPEG, it supports advanced compression, transparency via alpha channels, and various animation types. The format remains niche and largely obsolete in mainstream web browsers due to restrictive patent licensing and legal concerns associated with the underlying HEVC technology.
Validation Code
How to validate .bpg files in Python
Python
def is_bpg(file_path: str) -> bool:
"""Check if file is a valid BPG by magic bytes."""
signature = bytes([0x42, 0x50, 0x47, 0xFB])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .bpg files in Node.js
Node.js
function isBPG(buffer: Buffer): boolean {
const signature = Buffer.from([0x42, 0x50, 0x47, 0xFB]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsBPG(data []byte) bool {
signature := []byte{0x42, 0x50, 0x47, 0xFB}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/bpg
curl https://filesignature.org/api/v1/bpg