Photoshop image file
image/vnd.adobe.photoshop
Magic Bytes
Offset: 0
38 42 50 53
The Photoshop Document (PSD) is a proprietary image format developed and maintained by Adobe Inc. for complex raster graphics. It serves as the native format for Adobe Photoshop, supporting advanced features like multiple layers, masks, alpha channels, and vector paths. While considered a safe format for general use, the complexity of the specification allows for extensive metadata and hidden layers that may carry sensitive information if not properly flattened.
Validation Code
How to validate .psd files in Python
Python
def is_psd(file_path: str) -> bool:
"""Check if file is a valid PSD by magic bytes."""
signature = bytes([0x38, 0x42, 0x50, 0x53])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .psd files in Node.js
Node.js
function isPSD(buffer: Buffer): boolean {
const signature = Buffer.from([0x38, 0x42, 0x50, 0x53]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsPSD(data []byte) bool {
signature := []byte{0x38, 0x42, 0x50, 0x53}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/psd
curl https://filesignature.org/api/v1/psd