Skip to content

README: the thumbnail path, and what it costs - #128

Merged
tannevaled merged 1 commit into
mainfrom
thumbnails-for-a-page-strip
Nov 1, 2026
Merged

tannevaled merged 1 commit into
mainfrom
thumbnails-for-a-page-strip

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Asked for through the go-slides session on 2026-10-22, relayed by agentsync and unactioned since: go-widgets/toolkit has PageStrip, a virtualised strip of page thumbnails, and wants a pure-Go page-to-RGBA rasteriser cheap enough for ~100 thumbnails and safe on untrusted files. The message said: if render already does this, document the thumbnail path; if not, that is the gap.

⛔ It already does, which is why this is a README commit and not a feature. Scale is the thumbnail control, MaxPixels caps what comes out, MaxDuration caps the work of making it, and a timeout returns the page as far as it got with ErrTimedOut rather than a blank. raster.Image.ToNRGBA hands a toolkit what it wants. Nothing was missing — and nothing said so either, which is the gap this closes.

Measured on a 68-page scanned book, at load average 25 so the figures are pessimistic:

scale per thumbnail worst page
0.15 21.9 ms 54 ms
0.25 21.7 ms 93 ms
0.50 20.3 ms 31 ms

⛔ The scale barely moves it, and that is the part worth knowing. Ten times the pixels cost the same, because on a scanned page the time goes into decoding the embedded image, not into rasterising it. For scans a larger thumbnail is nearly free and a smaller one saves nothing — the opposite of what a caller sizing thumbnails down to save time would assume.

🤖 Generated with Claude Code

Asked for through the go-slides session on 2026-10-22, relayed by agentsync
and unactioned since: go-widgets/toolkit has PageStrip, a virtualised strip of
page thumbnails, and wants a pure-Go page-to-RGBA rasteriser cheap enough for
~100 thumbnails and safe on untrusted files. The message said: if render
already does this, DOCUMENT the thumbnail path; if not, that is the gap.

⛔ It already does, which is why this is a README commit and not a feature.
Scale is the thumbnail control, MaxPixels caps what comes out, MaxDuration
caps the work of making it, and a timeout returns the page AS FAR AS IT GOT
with ErrTimedOut rather than a blank. raster.Image.ToNRGBA hands a toolkit
what it wants. Nothing was missing; nothing said so either.

MEASURED on a 68-page scanned book, at load average 25 so the figures are
pessimistic: 21.9 ms per thumbnail at scale 0.15, 21.7 at 0.25, 20.3 at 0.50.

⛔ THE SCALE BARELY MOVES IT, and that is the part worth knowing. Ten times
the pixels cost the same, because on a scanned page the time goes into
DECODING THE EMBEDDED IMAGE, not into rasterising it. So for scans a larger
thumbnail is nearly free and a smaller one saves nothing -- the opposite of
what a caller sizing thumbnails down to save time would assume.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 42d5efd into main Nov 1, 2026
13 checks passed
@tannevaled
tannevaled deleted the thumbnails-for-a-page-strip branch November 1, 2026 09:14
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.

1 participant