From b2aaf09e46d6c7450311c5f684f3d811521b3ad1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 26 Aug 2026 22:44:05 -0400 Subject: .ssp digest: add image file's own pixel dimensions Complete image file digest identity record: add px:x to the .ssp image record, read from the image file header (imageformats.read_image_info, no decode): .image: won_benkler_2_1.png sha256:5BA4...D128 bytes:93861 px:420x342 (The w##h## dimensions in the markup are display dimensions, not the file's: they are author set, or where given as w0h0 are derived by _image_dimensions and capped to a maximum display width, and they become the width/height attributes of the output format image display). (assisted by Claude-Code) --- org/ocda_functions.org | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'org/ocda_functions.org') diff --git a/org/ocda_functions.org b/org/ocda_functions.org index 4745bc5..71d1b97 100644 --- a/org/ocda_functions.org +++ b/org/ocda_functions.org @@ -3448,6 +3448,24 @@ SHA_256_Hashes_ obj_digest(M)( writeln("WARNING, image not found or unreadable: ", filename, "\n ", file_with_path); } + /+ ↓ the image file's own pixel dimensions, which are not the display + dimensions carried by the markup (w##h##): those are author set, or + where given as w0h0 are derived by _image_dimensions and capped to + a maximum display width. Header read only, no decode. + +/ + if (!_file_info.fileMissing) { + import imageformats; + int _w, _h, _chans; + try { + read_image_info(file_with_path, _w, _h, _chans); + _file_info.imageWidth = _w; + _file_info.imageHeight = _h; + } catch (Exception ex) { + debug(images) { + writeln("image dimensions not read: ", filename); + } + } + } return _file_info; } obj.metainfo.sha256.text = obj.text.sha256Of; -- cgit v1.2.3