mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 20:14:31 +01:00
craft-image-codecs reads and writes JPEG-LS since #1576, but the format registry had no entry for it. A `.jls` name resolved to no format, and a JPEG-LS file was reported as JPEG because both start with `FF D8 FF`. `Format::JpegLs` now has the `jls` extension, the `image/jls` media type and the codec mapping, so its capabilities come from the codec. A file that starts with `FF D8 FF` is JPEG-LS when its marker segments lead to an SOF55 frame header (`FF F7`). The walk follows `jpeg_frame_from` in craft-image-codecs, which a build without the `raster-codecs` feature does not link, and reads at most the first 1 MiB. When the bytes end before any frame header, a `.jls` name gives JPEG-LS and any other name gives JPEG. craft-file-import routes `JpegLs` to its raster reader and lists `jls` and `image/jls`, so a JPEG-LS file still imports as it did when it was detected as JPEG. Follows #1576.