Commit Graph
21 Commits
Author SHA1 Message Date
dotCooCoo a524687f93 file-formats: register JPEG-LS and tell it from JPEG
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.
2026-11-19 11:02:50 -08:00
William Dunn 56c3c833bb file-formats: let the codec decide whether JXL reads (#2278)
Every workspace gate with `--all-features` has been failing since #2135 taught
craft-image-codecs to read JPEG XL behind a `jxl` feature. The capability test
asserted that JXL read is `Unsupported`, full stop. With that codec feature on,
`capabilities()` forwards the codec's own answer of `Available`. The assertion
then fails.

This crate cannot read that feature through `cfg!`. The feature belongs to a
dependency. A workspace build turns it on without this crate selecting
anything. An equality against either value is therefore wrong in some build.

The test now asks the codec the same question the code asks it. It compares
the two answers. A build whose codec reads JXL must report `Available`. One whose codec
does not must report `Unsupported`. The mapping has to exist either way. A missing
codec therefore fails an assertion of its own. The comparison is never quietly
skipped. Without `raster-codecs` there is no codec to ask. The answer is
`Unsupported`.

Verified at 1.100.0 on Linux. `cargo test -p craft-file-formats -p craft-image-codecs --all-features --locked` runs the case that was failing and passes. The same test passes with `-p craft-file-formats --all-features` and with `--no-default-features`. clippy with `--all-targets --all-features -D warnings` is clean. `cargo fmt --check` is clean. Making `capabilities()` ignore the codec's read flag fails the test. That is what the comparison is for. The HEIF and deep-EXR failures in that package need the pinned corpus. My checkout has not fetched it.
2026-11-19 00:43:07 -05:00
Dylan M. Taylor 6e7e752947 fix: resolve clippy nonminimal_bool and unexpected_cfgs on main (#2300) 2026-11-18 18:12:07 -05:00
Dylan M. Taylor ce7cefa554 fix: update JXL capability test and format craft-exr (#2298) 2026-11-18 17:58:04 -05:00
Dylan M. Taylor 3acb181c87 Detect OpenEXR from its file signature 2026-11-13 07:47:09 -05:00
Dylan M. Taylor 437bb0267b Respect Affinity short suffix for mismatched pixels 2026-11-13 05:57:37 -05:00
Dylan M. Taylor 9850c8d4f6 Recognize Affinity short extension 2026-11-13 05:47:50 -05:00
Dylan M. Taylor 2cd289fad6 Route container and raw signatures through shared formats 2026-11-13 05:46:14 -05:00
Dylan M. Taylor 6de1ffc9d7 Add shared format capability catalog 2026-11-13 04:53:57 -05:00
Dylan M. Taylor 8abfa9d0f1 Classify legacy Excel extensions in shared registry 2026-11-13 01:53:37 -05:00
Dylan M. Taylor 71337f6772 Add shared CSV and TSV file formats 2026-11-13 01:51:08 -05:00
Dylan M. Taylor fccc008271 Detect DesignCraft and IDML document content 2026-11-13 01:44:49 -05:00
Dylan M. Taylor b4ada28f19 Fix format registry clippy and add ASE support 2026-11-13 01:37:48 -05:00
Dylan M. Taylor 6ba1ca33ca Recognize InDesign files in shared registry 2026-11-13 01:27:11 -05:00
Dylan M. Taylor 1f9c271f7d Recognize legacy Word extension in shared registry 2026-11-13 01:26:09 -05:00
Dylan M. Taylor 32529b94e8 Resolve plain text format extensions 2026-11-13 01:24:40 -05:00
Dylan M. Taylor fc9ecb40e7 Extend shared file-format registry 2026-11-13 01:22:58 -05:00
Dylan M. Taylor d8cc88a772 Add image document formats to shared registry 2026-11-13 00:39:59 -05:00
Dylan M. Taylor c1a1b976d0 Resolve raster subformats centrally 2026-11-13 00:34:48 -05:00
Dylan M. Taylor 8d3c753b5e Recognize G-code filename extensions 2026-11-13 00:34:11 -05:00
Dylan M. Taylor 79c2003ac9 Add shared file format detection 2026-11-13 00:30:56 -05:00