Skip to content

File: optional width/height for visual files - #1183

Merged
coodos merged 1 commit into
mainfrom
meshenger/file-image-dimensions
Oct 8, 2026
Merged

coodos merged 1 commit into
mainfrom
meshenger/file-image-dimensions

Conversation

@EgorPPS

@EgorPPS EgorPPS commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Two optional integer properties on File: width and height, in pixels.

Why

A file's pixel size is a property of the file. Any application laying out an
image needs it before the bytes arrive — otherwise it reserves a guessed box
and corrects it on decode, which moves everything already on screen.

We hit this as a concrete defect in Meshenger. Scrolling back through a chat of
photographs moved the reader by hundreds of pixels per screen; the worst single
row shifted 330 px, because the box was reserved from a per-device guess (aspect
1.2) while the picture was 0.46. The user's words were "очень много дерганий и
автопрокручиваний"
.

Our first fix put the dimensions into our own Message envelope, and that is
why this PR exists rather than a changelog entry. A photo editor or a video
editor reading the same data has no reason to look inside a messaging ontology
for a picture's size — it would re-derive it per device, or never find it.

Why not MediaAsset

MediaAsset already carries width/height, which suggests the ecosystem does
want these two numbers. But it requireds observationRef, binding them to an
Observation. A photograph sent in a chat has no observation, and inventing one
to carry two integers would be worse than the problem it solves.

If you would rather these live only on MediaAsset, we would need a way to use
it without an observation — happy to send that PR instead.

Why it has to come from the schema

File is "additionalProperties": false. No application can add these
privately without its envelopes failing strict validation in any reader that
enforces the schema. (We have been bitten by precisely that on another strict
ontology, so our File writes stay inside the registered field set.)

Compatibility

Purely additive. Both optional, required unchanged, no existing field touched.
A reader that does not know them behaves exactly as today; a writer that does
not measure omits them. Range is minimum: 1 — a zero-pixel image is not a
thing, and allowing 0 would let a bad writer reserve an empty box.

Follow-up, if this shape is welcome

We carry other file-describing facts in the wrong envelope for the same reason
(how the phone was held when a photo was taken, which recording a frame belongs
to and at what offset). We would rather propose those here, one concern at a
time, than keep a private dialect of a shared schema.

@EgorPPS
EgorPPS requested a review from coodos as a code owner October 2, 2026 14:29
@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 9b34a517-3f11-44d9-adc6-113aad77209e

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coodos
coodos merged commit e3dad97 into main Oct 8, 2026
4 checks passed
@coodos
coodos deleted the meshenger/file-image-dimensions branch October 8, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants