{"id":"image-jls","mimeType":"image/jls","name":"JPEG-LS","shortName":"JPEG-LS","category":"Medical \u0026 Archival","extensions":[".jls",".jl"],"description":"The image/jls MIME type represents the JPEG-LS format, an international standard (ISO/IEC 14495) for the lossless and near-lossless compression of continuous-tone images. Developed heavily by HP Labs and utilizing the LOCO-I (Low Complexity Lossless Compression for Images) algorithm, it relies on predictive coding rather than the computationally expensive transforms (like DCT or wavelets) used in standard JPEG or JPEG 2000. Because it requires very low hardware complexity and delivers exceptional lossless compression, it is a dominant format in medical imaging (DICOM) and aerospace applications.","seo":{"title":"image/jls MIME Type | Complete Developer Reference for JPEG-LS","description":"Complete reference for the image/jls MIME type: magic bytes, the LOCO-I algorithm, medical DICOM applications, developer snippets, and technical specifications.","faqs":[{"question":"What is the difference between JPEG-LS and JPEG 2000?","answer":"JPEG-LS was designed specifically for lossless and near-lossless compression. It uses a predictive coding algorithm (LOCO-I) that is mathematically much simpler and faster to compute than the wavelet transforms used in JPEG 2000. While JPEG 2000 offers better scalability and progressive loading, JPEG-LS often provides slightly better lossless compression ratios and significantly faster encoding/decoding speeds, making it ideal for medical modalities like X-rays and MRI scans."},{"question":"What are the magic bytes for a JPEG-LS file?","answer":"Because JPEG-LS is part of the JPEG family, its bitstream begins with the standard Start of Image (SOI) marker: FF D8. The format is specifically identified by the presence of the Start of Frame 55 (SOF55) marker, which is FF F7. In a raw bitstream without application headers, the file often begins directly with FF D8 FF F7."},{"question":"Can web browsers open image/jls files?","answer":"No modern web browsers natively support JPEG-LS. In web-based medical image viewers (like zero-footprint DICOM viewers), the JPEG-LS bitstream must be decoded on the client side using WebAssembly (Wasm) ports of libraries like CharLS, or decoded on the server and sent as a standard format like PNG or WebP."}]},"index":{"compression":["Lossless","Near-Lossless (Predictive Coding)"],"browserSupport":{"score":1,"label":"None"},"commonUses":["Medical Imaging (DICOM Encapsulation)","Space and Planetary Imaging (NASA/ESA)","Industrial Machine Vision","Scientific Archival Storage"]},"technical":{"magicBytes":{"hex":"FF D8 FF F7","ascii":"ÿØÿ÷"},"container":"JPEG Bitstream","compressionAlgorithm":["LOCO-I (Low Complexity Lossless Compression for Images)","Golomb-Rice Coding"],"colorDepth":["8-bit","12-bit","16-bit (Per Channel)"],"transparency":false,"animation":false,"metadata":{"exif":false,"xmp":false,"iccProfile":false},"alphaChannel":false,"progressiveLoading":false,"hdrSupport":true},"history":{"developer":"Joint Photographic Experts Group (ISO/ITU-T) \u0026 HP Labs","released":"1999","specification":"ISO/IEC 14495-1 | ITU-T Recommendation T.87"},"browserSupport":{"chrome":false,"chromeVersion":"None","firefox":false,"firefoxVersion":"None","safari":false,"safariVersion":"None","edge":false,"edgeVersion":"None","internetExplorer":false},"softwareSupport":[{"name":"CharLS (C++ JPEG-LS Library)","logo":""},{"name":"DCMTK (DICOM Toolkit)","logo":""},{"name":"ImageMagick","logo":"image-magic.webp"},{"name":"Orthanc (DICOM Server)","logo":""}],"conversion":{"convertTo":["dcm","png","tiff","jp2"],"convertFrom":["dcm","png","tiff"]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/jls"}],"htmlAccept":"image/jls, .jls","fileDetection":["Check the first two bytes for the standard JPEG Start of Image (SOI) marker: FF D8.","Scan the initial segment headers for the SOF55 (Start of Frame 55) marker (FF F7), which explicitly defines the bitstream as JPEG-LS."]},"prosCons":{"pros":["Provides state-of-the-art lossless compression ratios for continuous-tone images, often outperforming Lossless JPEG and JPEG 2000","Extremely fast and computationally inexpensive to encode/decode, requiring no complex floating-point math or DCTs","Highly resilient in constrained hardware environments, making it ideal for medical equipment and deep-space probes (e.g., Mars rovers)"],"cons":["Zero native support in web browsers or standard consumer operating systems","Lacks the advanced resolution scalability and progressive decoding features found in JPEG 2000","Primarily relegated to niche enterprise sectors (healthcare/DICOM and aerospace) rather than consumer adoption"]},"specifications":{"url":"https://jpeg.org/jpegls/","rfc":"","mimeAliases":["image/x-jls"]},"developerSnippets":{"python":"import magic\n# Libmagic may identify the standard JPEG SOI and mistakenly label this as 'image/jpeg' without deep marker inspection\nprint(magic.from_file('scan.jls', mime=True))","nodejs":"const fs = require('fs');\n// Manually detecting the JPEG-LS SOF55 marker directly following the SOI marker\nconst buffer = Buffer.alloc(4);\nconst fd = fs.openSync('scan.jls', 'r');\nfs.readSync(fd, buffer, 0, 4, 0);\nfs.closeSync(fd);\nconst isJpegLS = buffer[0] === 0xFF \u0026\u0026 buffer[1] === 0xD8 \u0026\u0026 buffer[2] === 0xFF \u0026\u0026 buffer[3] === 0xF7;\nconsole.log(isJpegLS);","go":"import (\n    \"bytes\"\n    \"net/http\"\n)\n// http.DetectContentType will incorrectly return 'image/jpeg' due to the FF D8 prefix.\n// Custom detection must verify the FF F7 (SOF55) marker.","php":"// Standard PHP setups will likely return 'image/jpeg' because it shares the same generic FF D8 file signature.\n$mime = mime_content_type('scan.jls');\necho $mime;"},"relatedFormats":["jpeg","png","tiff"]}
