Expand description
Image decoding worker.
Decodes an image file off the UI thread and turns it into a
PreviewContent::Image carrying the encoder state for the terminal’s
inline-image protocol. Which protocol that is, and whether pixel previews
are enabled at all, is decided by crate::preview::graphics.
Decoding is the expensive part (a large JPEG can take tens of milliseconds),
which is why it runs on spawn_blocking and reports back through
WorkerMsg::ImageMeta tagged with the preview generation. Resizing and
encoding for the pane’s current size happen later, on the UI thread, and are
cached by ratatui-image until the pane changes size.
Functions§
- spawn_
image_ decode - Decodes
pathoff-thread, sending aWorkerMsg::ImageMetaresult throughtxtagged withgeneration.