mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 21:52:32 +00:00
* image-codecs: read a raster's resolution from its headers (resolution_probe) file_resolution(bytes) gives the pixels per inch a JPEG, PNG, WebP, BMP or classic TIFF records without decoding pixels. JPEG uses the decoder's marker scan (Photoshop, XMP, EXIF, then JFIF), PNG reads pHYs as the decoder does and falls back to eXIf, WebP its EXIF chunk, TIFF its IFD0 tags; BMP reads the info header's pixels per metre. Values outside 1-100000 ppi count as none. DesignCraft (crates/images/src/resolution.rs) and FigCraft (crates/format/src/density.rs) each carry their own marker and chunk walkers for this; they can switch to the shared probe. Part of #778 and #785. * image-codecs: resolution_probe reads only a whole nine-byte pHYs, and a zero one leaves eXIf A pHYs chunk that declares any other length, or is cut off before its CRC, records nothing, and its data is no longer read from the bytes after it. A zero pixels-per-metre count records nothing either, as in the decoder, so the eXIf resolution still answers.