Bakes Etcher annotation shapes into a single PNG thumbnail variant.
A file with annotations gets one extra variant — "thumbnail_annotated" — a
small square PNG with the shapes drawn on top (via ImageMagick convert -draw). The media browser grid uses it instead of the plain thumbnail, so the
markup is visible without rendering shapes live for every viewer.
It's a single deterministic variant slot: each regeneration overwrites it (no history piles up). When the last annotation is removed, the variant is dropped and the grid falls back to the plain thumbnail.
Shapes are stored in image-pixel coordinates, so they're drawn at original
scale on the original image (the geometry → draw mapping lives in
Etcher.Raster, which owns the shape format), then the whole thing is resized
- center-cropped to the thumbnail square — the crop clips edge shapes exactly like the grid.
Regeneration is meant to run in the background (see AnnotationThumbnailJob),
debounced so a flurry of edits collapses into one render.
Summary
Functions
The site-wide default for annotated thumbnails (media setting; default
false). A library may choose otherwise (enabled_for?/1, which is what
generation and display ask) — see the media settings page, "Media
Configuration" section for this default and the Libraries tab for the
per-library choice.
The libraries of library_uuids that have annotated thumbnails on, as a set
of uuid strings (nil stands for Media) — one query for a page of files.
Whether annotated thumbnails are on for a library: its own choice
(Libraries.setting/2, per library) when it has made one, otherwise the site
setting (enabled?/0). Takes a library or a library uuid (nil is Media).
enabled_for?/1 for the library file is in.
enabled_for?/1 for the library of the file with file_uuid. A file that is
not there follows the site setting.
Regenerate (or remove) the baked annotated thumbnail for file_uuid.
The variant name this module produces.
Functions
The site-wide default for annotated thumbnails (media setting; default
false). A library may choose otherwise (enabled_for?/1, which is what
generation and display ask) — see the media settings page, "Media
Configuration" section for this default and the Libraries tab for the
per-library choice.
The libraries of library_uuids that have annotated thumbnails on, as a set
of uuid strings (nil stands for Media) — one query for a page of files.
Whether annotated thumbnails are on for a library: its own choice
(Libraries.setting/2, per library) when it has made one, otherwise the site
setting (enabled?/0). Takes a library or a library uuid (nil is Media).
enabled_for?/1 for the library file is in.
enabled_for?/1 for the library of the file with file_uuid. A file that is
not there follows the site setting.
Regenerate (or remove) the baked annotated thumbnail for file_uuid.
Returns {:ok, instance} when (re)generated, {:ok, :removed} when there's
nothing to draw, or {:error, reason}.
The variant name this module produces.