{"success":true,"data":{"ext":"png","name":"Portable Network Graphics file","description":"Portable Network Graphics (PNG) is a raster image file format originally developed by the PNG Development Group and standardized by the W3C and ISO/IEC. It is commonly used for web graphics, screenshots, icons, and images that require lossless compression or transparent backgrounds, and it is supported by most operating systems, browsers, and image editors. PNG files are generally considered safe, although malformed images have occasionally exposed vulnerabilities in rendering software.","mime":["image/png"],"risk_level":"Safe","signatures":[{"hex":"89 50 4E 47 0D 0A 1A 0A","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"},{"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"},{"name":"Neil Harvey FileSignatures","url":"https://raw.githubusercontent.com/neilharvey/FileSignatures/master/src/FileSignatures/Formats/Png.cs"}]}],"related":["gif","pgm","avif","bmp","cr2","cr3"],"usage":{"python":"def is_png(file_path: str) -> bool:\n    \"\"\"Check if file is a valid PNG by magic bytes.\"\"\"\n    signature = bytes([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])\n    with open(file_path, \"rb\") as f:\n        return f.read(8) == signature","node":"function isPNG(buffer: Buffer): boolean {\n  const signature = Buffer.from([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]);\n  return buffer.subarray(0, 8).equals(signature);\n}","go":"func IsPNG(data []byte) bool {\n    signature := []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}\n    if len(data) < 8 {\n        return false\n    }\n    return bytes.Equal(data[:8], signature)\n}"},"category":"Images"}}