{"success":true,"data":{"ext":"pgm","name":"Portable Graymap Graphic","description":"Portable Graymap (PGM) is a plain-text or binary grayscale image format in the Netpbm family, developed and maintained by the Netpbm project. It is used for simple grayscale graphics, image processing workflows, and interchange between older Unix tools and research software. The format is lightweight and long established; as a legacy interchange format, it is generally safe, though unusually large files may consume significant memory when decoded.","mime":["image/x-portable-graymap"],"risk_level":"Safe","signatures":[{"hex":"50 35 0A","offset":0,"sources":[{"name":"Wikipedia","url":"https://en.wikipedia.org/wiki/List_of_file_signatures"},{"name":"Gary Kessler","url":"https://www.garykessler.net/library/file_sigs_GCK_latest.html"}]},{"hex":"50 32","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"50 32 0A","offset":0,"sources":[{"name":"Wikipedia","url":"https://en.wikipedia.org/wiki/List_of_file_signatures"}]}],"related":["png","avif","bmp","cr2","cr3","dib"],"usage":{"python":"def is_pgm(file_path: str) -> bool:\n    \"\"\"Check if file is a valid PGM by magic bytes.\"\"\"\n    signature = bytes([0x50, 0x35, 0x0A])\n    with open(file_path, \"rb\") as f:\n        return f.read(3) == signature","node":"function isPGM(buffer: Buffer): boolean {\n  const signature = Buffer.from([0x50, 0x35, 0x0A]);\n  return buffer.subarray(0, 3).equals(signature);\n}","go":"func IsPGM(data []byte) bool {\n    signature := []byte{0x50, 0x35, 0x0A}\n    if len(data) < 3 {\n        return false\n    }\n    return bytes.Equal(data[:3], signature)\n}"},"category":"Images"}}