Skip to content

Improve image thumbnail and video poster sharpness #14

Description

@dremnik

Summary

Image thumbnails and video poster frames look visibly soft on the canvas. The current preview pipeline produces one fixed-size JPEG and reuses it regardless of the card dimensions, canvas zoom, or display pixel ratio.

Evidence

  • src-tauri/src/media/poster.rs:33-40 generates both image thumbnails and video posters with a maximum width of 640 pixels.
  • src/canvas/shapes/ItemShapeUtil.tsx:181-189 stretches that preview to fill the rendered card.
  • The preview request does not communicate the card size, canvas zoom, or devicePixelRatio.
  • A resized card or Retina display can therefore request substantially more display pixels than the cached preview contains.

Proposed change

  1. Define a canvas-preview sharpness target for the development Retina Mac.
  2. Generate a small set of bounded preview variants, such as 320, 640, 1280, and 2048 pixels, for both images and video posters.
  3. Select the smallest variant that covers the rendered card dimensions multiplied by display pixel ratio, with a bounded zoom policy.
  4. Upgrade a card to a larger cached variant when its required display resolution crosses a threshold.
  5. Set explicit encoder quality instead of relying on ffmpeg defaults.
  6. Version the thumbnail cache key so existing low-resolution previews regenerate safely.
  7. Keep generation asynchronous and avoid decoding full-resolution media for every off-screen card.
  8. Measure the memory, disk, generation-time, and pan-frame impact against the 200-item fixture.

Acceptance criteria

  • Image thumbnails and video posters appear crisp at the normal canvas zoom on the development Retina Mac.
  • A card is not visibly upscaled beyond the documented tolerance at supported zoom levels.
  • Resizing a card can request a sharper cached variant without blocking interaction.
  • Image and video previews follow the same sizing and quality policy.
  • Existing 640-pixel cache entries are regenerated or ignored after the cache-version change.
  • The warm-cache 200-item canvas still meets the performance target after viewport culling is implemented.
  • Tests cover variant selection, cache invalidation, image generation, video poster generation, and generation failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions