{"id":"image-x-icns","mimeType":"image/x-icns","name":"Apple Icon Image","shortName":"Apple-ICNS","category":"Icons \u0026 UI","extensions":[".icns"],"description":"The image/x-icns MIME type represents the Apple Icon Image format (ICNS), the native icon format used by macOS (formerly Mac OS X). An ICNS file acts as a container that bundles multiple resolutions and color depths of an icon into a single file, ensuring applications look sharp on everything from legacy standard-definition displays to modern high-density Retina screens (ranging from 16x16 to 1024x1024 pixels). While early versions stored uncompressed raw pixel data with separate 8-bit alpha masks, modern macOS versions encapsulate standard PNG or JPEG 2000 streams within the ICNS chunks for higher resolutions.","seo":{"title":"image/x-icns MIME Type | Developer Reference for Apple ICNS","description":"Complete reference for the image/x-icns MIME type: Apple Icon Image format (ICNS), macOS app icons, Retina resolutions, and magic byte detection.","faqs":[{"question":"What is an ICNS file?","answer":"An ICNS file is the standard icon format used by Apple's macOS. It stores multiple sizes of an icon inside a single file so the operating system can seamlessly switch to the appropriate resolution depending on the display (e.g., standard vs. Retina) or context (e.g., Finder vs. Dock)."},{"question":"How do I create an ICNS file?","answer":"Developers typically create ICNS files using Apple's Xcode via an '.iconset' folder, or through command-line utilities like 'iconutil' on macOS. There are also third-party tools and web converters that can compile a set of PNGs into an ICNS file for Windows or Linux users."},{"question":"Can I use an ICNS file as a favicon on a website?","answer":"No. Web browsers do not natively support the ICNS format. You must convert it to an ICO, PNG, or SVG file to use it as a website favicon."}]},"index":{"compression":["Uncompressed (Legacy)","PNG (Modern)","JPEG 2000 (Modern)"],"browserSupport":{"score":1,"label":"None"},"commonUses":["macOS Application Bundles (.app)","macOS Folder Customization","Apple Disk Image (.dmg) Styling"]},"technical":{"magicBytes":{"hex":"69 63 6E 73","ascii":"icns"},"container":"Chunk-based (OSType Header)","compressionAlgorithm":["None","Deflate (via embedded PNG)","Wavelet (via embedded JP2)"],"colorDepth":["1-bit (Monochrome)","4-bit","8-bit","24-bit (RGB)","32-bit (RGBA)"],"transparency":true,"animation":false,"metadata":{"exif":false,"xmp":false,"iccProfile":true},"alphaChannel":true,"progressiveLoading":false,"hdrSupport":false},"history":{"developer":"Apple Inc.","released":"2001","specification":"Proprietary (Heavily reverse-engineered)"},"browserSupport":{"chrome":false,"chromeVersion":"None","firefox":false,"firefoxVersion":"None","safari":false,"safariVersion":"None","edge":false,"edgeVersion":"None","internetExplorer":false},"softwareSupport":[{"name":"Apple Preview","logo":""},{"name":"Xcode (iconutil)","logo":""},{"name":"ImageMagick","logo":"image-magic.webp"},{"name":"GIMP","logo":"gimp.svg"}],"conversion":{"convertTo":["png","ico","tiff"],"convertFrom":["png","ico","tiff"]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/x-icns"},{"header":"Content-Type","value":"image/icns"}],"htmlAccept":"image/x-icns, .icns","fileDetection":["Check the first 4 bytes for the ASCII string 'icns' (Hex: 69 63 6E 73).","The next 4 bytes form a 32-bit big-endian integer representing the total file size in bytes.","The rest of the file consists of data chunks, each starting with a 4-byte OSType identifier (e.g., 'ic08' for a 256x256 icon) and a 4-byte chunk length."]},"prosCons":{"pros":["Seamlessly handles multi-resolution scaling on macOS, perfectly serving both standard and high-DPI (Retina) displays from a single asset","Modern versions efficiently embed standard PNG files, making it much easier to parse the high-resolution layers than the legacy raw pixel formats"],"cons":["Strictly bound to the Apple ecosystem; completely useless natively on Windows, Linux, or the Web","The internal chunking structure is notoriously messy, utilizing dozens of different undocumented, legacy OSType tags spanning 20+ years of Apple history"]},"specifications":{"url":"https://en.wikipedia.org/wiki/Apple_Icon_Image_format","rfc":"","mimeAliases":["image/icns","image/mac-icns"]},"developerSnippets":{"python":"import magic\n# Libmagic natively detects the 'icns' magic byte signature\nprint(magic.from_file('app_icon.icns', mime=True)) # Outputs 'image/x-icns'","nodejs":"const fs = require('fs');\n// Manually detecting the 'icns' magic bytes\nconst buffer = Buffer.alloc(4);\nconst fd = fs.openSync('app_icon.icns', 'r');\nfs.readSync(fd, buffer, 0, 4, 0);\nfs.closeSync(fd);\nconst isICNS = buffer.toString('ascii') === 'icns';\nconsole.log('Is Apple ICNS:', isICNS);","go":"import (\n    \"bytes\"\n    \"net/http\"\n)\n// Custom check for the ICNS Magic Bytes\n// isICNS := bytes.HasPrefix(buf, []byte(\"icns\"))","php":"$mime = mime_content_type('app_icon.icns');\necho $mime; // Standard setups will often resolve this to 'image/x-icns' or 'image/icns'"},"relatedFormats":["ico","png","tiff"]}
