Skip to main content

Module thumbnail

Module thumbnail 

Source
Expand description

Thumbnails of image jobs, so the tray UI can show what a job made.

The daemon decodes an image result, scales it to fit THUMBNAIL_MAX_SIDE and keeps it as PNG in a bounded Thumbnails ring keyed by job id. The tray UI keeps its own copy (fetched from GET /jobs/:id/thumbnail) in the same type.

Structs§

Thumbnails
Bounded ring of PNG thumbnails keyed by job id, oldest evicted first. Cheap to clone.

Constants§

THUMBNAILS_CAP
Thumbnails of this many most recent image jobs are kept: the size of the studio and local job rings together.
THUMBNAIL_MAX_SIDE
Longer side of a thumbnail, in pixels: crisp on the UI’s 88 pt card tile on a 2x display, and large enough to recognise when shown larger. About 0.1 to 0.4 MB of PNG each, so the 100 kept stay within tens of MB.

Functions§

make_thumbnail
Scale an encoded image (WEBP / PNG / JPEG) to fit THUMBNAIL_MAX_SIDE and encode it as PNG. Smaller images keep their size.