PAM
image/x-portable-arbitrarymap
Magic Bytes
Offset: 0
50 37
Portable Arbitrary Map (PAM) is a flexible image format created by the Netpbm project to unify and extend the Portable Anymap family. It is primarily used as an intermediate format for image conversion and computer vision tasks because it supports multiple channels and variable color depths. Since the format uses a straightforward header and uncompressed pixel data, it is considered highly secure and lacks the complexity required for modern metadata-based file exploits.
Validation Code
How to validate .pam files in Python
Python
def is_pam(file_path: str) -> bool:
"""Check if file is a valid PAM by magic bytes."""
signature = bytes([0x50, 0x37])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .pam files in Node.js
Node.js
function isPAM(buffer: Buffer): boolean {
const signature = Buffer.from([0x50, 0x37]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsPAM(data []byte) bool {
signature := []byte{0x50, 0x37}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/pam
curl https://filesignature.org/api/v1/pam