Grill: full-resolution image/GIF preference rules #33

Closed
opened 2026-08-03 15:00:35 +00:00 by TheAnachronism · 1 comment

Part of #30

Question

Without site scrapers, what generic rules should the Reader use to prefer a full-resolution image/GIF when multiple candidates already exist in the article HTML, links, and/or enclosures?

Probe with the Reddit example (.scratch/rss-examples/reddit-example.xml): preview.redd.it <img> + i.redd.it [link] + preview enclosure. Also invent non-Reddit cases (srcset, linked originals, thumbnail+full pairs) so the rule stays feed-agnostic.

Decide: candidate gathering, ranking/preference, when not to replace the visible <img>, and how this interacts with enclosure promotion.

Part of #30 ## Question Without site scrapers, what **generic** rules should the Reader use to prefer a full-resolution image/GIF when multiple candidates already exist in the article HTML, links, and/or enclosures? Probe with the Reddit example (`.scratch/rss-examples/reddit-example.xml`): preview.redd.it `<img>` + i.redd.it `[link]` + preview enclosure. Also invent non-Reddit cases (srcset, linked originals, thumbnail+full pairs) so the rule stays feed-agnostic. Decide: candidate gathering, ranking/preference, when *not* to replace the visible `<img>`, and how this interacts with enclosure promotion.
Author
Owner

Resolution

Generic full-resolution image/GIF preference (no site scrapers):

  1. Candidates for an existing <img>: wrapping <a href>; other same-article <a href> image URLs that share basename with the visible src; same-article image enclosures; and srcset / data-full-url-style attributes on the img.
  2. Rank: prefer larger declared width/height (or denser srcset candidate); else prefer a URL that drops resize/thumb query params or path markers (width=, crop=, /thumb(nail)/, etc.); else keep the visible src.
  3. Do not replace unless the candidate looks like an image URL (common image extension or image/* enclosure) and shares basename / a clear size-upgrade relationship with the visible src. Never swap in an HTML permalink or unrelated page URL.
  4. Order vs promotion: run preference on existing <img>s first (enclosures may supply the upgrade). Enclosures already used as an upgrade are consumed; leftovers are for Grill: enclosure promotion and dedupe rules, which must not inject a second copy.

Reddit fixture: preview.redd.it preview <img> upgrades via sibling i.redd.it [link] (same basename); the preview enclosure is not a better URL than the visible src.

## Resolution **Generic full-resolution image/GIF preference** (no site scrapers): 1. **Candidates** for an existing `<img>`: wrapping `<a href>`; other same-article `<a href>` image URLs that share basename with the visible `src`; same-article image enclosures; and `srcset` / `data-full-url`-style attributes on the img. 2. **Rank**: prefer larger declared width/height (or denser `srcset` candidate); else prefer a URL that drops resize/thumb query params or path markers (`width=`, `crop=`, `/thumb(nail)/`, etc.); else keep the visible `src`. 3. **Do not replace** unless the candidate looks like an image URL (common image extension or `image/*` enclosure) **and** shares basename / a clear size-upgrade relationship with the visible `src`. Never swap in an HTML permalink or unrelated page URL. 4. **Order vs promotion**: run preference on existing `<img>`s first (enclosures may supply the upgrade). Enclosures already used as an upgrade are consumed; leftovers are for [Grill: enclosure promotion and dedupe rules](https://git.anachronis.dev/TheAnachronism/tt-rss-viewer/issues/34), which must not inject a second copy. **Reddit fixture:** `preview.redd.it` preview `<img>` upgrades via sibling `i.redd.it` `[link]` (same basename); the preview enclosure is not a better URL than the visible `src`.
Sign in to join this conversation.
No description provided.