{"id":"image-pwg-raster","mimeType":"image/pwg-raster","name":"PWG Raster Format","shortName":"PWG-Raster","category":"Printing \u0026 Imaging","extensions":[".pwg",".ras"],"description":"The image/pwg-raster MIME type represents the PWG Raster format, a standardized raster graphics format developed by the IEEE-ISTO Printer Working Group (PWG). Built as a heavily constrained, highly specific subset of the CUPS Raster version 2 format, it was designed specifically for driverless network printing over the Internet Printing Protocol (IPP). It forms the foundational imaging backbone for universal mobile and desktop printing technologies like IPP Everywhere, Wi-Fi Direct Print, and Apple AirPrint, allowing client devices to send pre-rasterized, ready-to-print bitmaps directly to low-power printers without requiring manufacturer-specific software drivers.","seo":{"title":"image/pwg-raster MIME Type | Complete Developer Reference for IPP Printing","description":"Complete reference for the image/pwg-raster MIME type: magic bytes, IPP Everywhere compatibility, Apple AirPrint workflows, and CUPS developer snippets.","faqs":[{"question":"What is the difference between PWG Raster and PDF for printing?","answer":"PDF is a complex document format containing vector graphics, fonts, and text that requires a powerful processor and a RIP (Raster Image Processor) on the printer to decode and rasterize. PWG Raster is a pre-rendered, highly compressed bitmap format. Mobile devices (which have powerful CPUs) convert documents to PWG Raster so that cheap, low-memory printers can simply stream the pixels directly to the printhead without complex processing."},{"question":"What is the relationship between PWG Raster and CUPS Raster?","answer":"PWG Raster is structurally identical to CUPS Raster version 2. However, it imposes strict limitations on the color spaces, bit depths, and resolutions allowed, ensuring that any PWG Raster file can be universally understood by any IPP Everywhere-certified printer, eliminating the proprietary variations found in standard CUPS pipelines."},{"question":"What are the magic bytes for a PWG Raster file?","answer":"Because it is based on CUPS Raster v2, a PWG Raster file begins with the ASCII string 'RaS2', which corresponds to the hexadecimal bytes 52 61 53 32."}]},"index":{"compression":["PackBits (Run-Length Encoding)"],"browserSupport":{"score":1,"label":"None"},"commonUses":["Driverless Network Printing (IPP Everywhere)","Apple AirPrint and Mopria Print Service Pipelines","CUPS (Common UNIX Printing System) Spooling"]},"technical":{"magicBytes":{"hex":"52 61 53 32","ascii":"RaS2"},"container":"CUPS Raster v2 Container","compressionAlgorithm":["PackBits (Apple RLE variant)"],"colorDepth":["1-bit (Monochrome/K)","8-bit (Grayscale)","24-bit (sRGB / Adobe RGB)","32-bit (CMYK)"],"transparency":false,"animation":false,"metadata":{"exif":false,"xmp":false,"iccProfile":false},"alphaChannel":false,"progressiveLoading":false,"hdrSupport":false},"history":{"developer":"IEEE-ISTO Printer Working Group (PWG)","released":"2011","specification":"PWG 5102.4 (PWG Raster Format)"},"browserSupport":{"chrome":false,"chromeVersion":"None","firefox":false,"firefoxVersion":"None","safari":false,"safariVersion":"None","edge":false,"edgeVersion":"None","internetExplorer":false},"softwareSupport":[{"name":"CUPS (Common UNIX Printing System)","logo":""},{"name":"Ghostscript","logo":""},{"name":"Apple AirPrint Spooler","logo":""}],"conversion":{"convertTo":["png","tiff"],"convertFrom":["jpeg","png","postscript"]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/pwg-raster"}],"htmlAccept":"image/pwg-raster, .pwg","fileDetection":["Check the first 4 bytes for the synchronization word 'RaS2' (52 61 53 32).","Read the subsequent page header (1796 bytes long), which contains IPP-specific attributes such as MediaClass, MediaColor, and Resolution required by the print engine."]},"prosCons":{"pros":["The undisputed global standard for modern, driverless printing environments, eliminating the nightmare of installing manufacturer-specific print drivers","Extremely lightweight to decode on embedded hardware, requiring minimal RAM buffers on the printer side","Strict color space and resolution rules guarantee that the printed output will successfully process without syntax errors"],"cons":["Generates massive file sizes and network payloads compared to vector-based formats like PDF or PostScript, as every page is fully rasterized at 300+ DPI before transmission","No support for native rendering in web browsers, image viewers, or graphic design software without specialized CUPS developer tools","Cannot store complex metadata, vector text, or layers"]},"specifications":{"url":"https://ftp.pwg.org/pub/pwg/candidates/cs-ippraster10-20120217-5102.4.pdf","rfc":"","mimeAliases":["application/vnd.cups-raster"]},"developerSnippets":{"python":"import magic\n# Note: Due to its specialized use in IPP print spools, libmagic may just identify it generically as a CUPS raster file\nprint(magic.from_file('print_job.pwg', mime=True)) # May output 'application/vnd.cups-raster'","nodejs":"const fs = require('fs');\n// Manually detecting the 'RaS2' magic string used by PWG Raster\nconst buffer = Buffer.alloc(4);\nconst fd = fs.openSync('print_job.pwg', 'r');\nfs.readSync(fd, buffer, 0, 4, 0);\nfs.closeSync(fd);\nconst isPWGRaster = buffer.toString('ascii') === 'RaS2';\nconsole.log(isPWGRaster);","go":"import \"net/http\"\n// http.DetectContentType will not recognize this format. You must sniff the byte prefix directly.\n// isPWG := bytes.HasPrefix(buf, []byte(\"RaS2\"))","php":"// Standard web environments rarely encounter this format. It is primarily passed via HTTP POST requests to an IPP printer URI (e.g., /ipp/print)."},"relatedFormats":["tiff"]}
