Expand description
Encodes animated thumbnails.
A picture that carries a frame sequence can answer a request for an animated thumbnail with the frames themselves rather than one of them. The three containers MSC2705 names each hold a sequence differently, so each has its own decoder here, and all of them produce a GIF, which is the one animated format this build can encode.
The caps that bound the work live here rather than at either call site, so a source reaches no decoder before what it would cost is known.
Re-exportsΒ§
use std::cmp::min;πuse std::io::Cursor;πuse std::panic::AssertUnwindSafe;πuse std::panic::catch_unwind;πuse std::result::Result as StdResult;πuse bytes::Bytes;πuse image::AnimationDecoder;πuse image::DynamicImage;πuse image::Frame;πuse image::Frames;πuse image::ImageDecoder;πuse image::ImageFormat;πuse image::Limits;πuse image::codecs::gif::GifDecoder;πuse image::codecs::gif::GifEncoder;πuse image::codecs::gif::Repeat;πuse image::codecs::png::PngDecoder;πuse image::codecs::webp::WebPDecoder;πuse ruma::Mxc;πuse tokio::sync::OwnedSemaphorePermit;πuse tuwunel_core::Err;πuse tuwunel_core::Error;πuse tuwunel_core::Result;πuse tuwunel_core::defer;πuse tuwunel_core::err;πuse tuwunel_core::implement;πuse super::super::Media;πuse super::Dim;πuse super::animate::GIF;πuse super::generate::BYTES_PER_PIXEL;πuse super::generate::reader;πuse super::generate::thumbnail_generate;π
StructsΒ§
- Output π
ConstantsΒ§
- ANIMATED_
NAME π - GIF_
SPEED π - Quantization effort the GIF encoder spends per frame.
FunctionsΒ§
- canvas_
pixels π - Pixels one composited frame of this source occupies.
- decoder_
limits π - Creates decoder limits from the configured pixel budget.
- encode_
frames π - Encode a pictureβs frames as a GIF scaled to these dimensions.
- encode_
sequence π - Encodes a bounded frame sequence into one GIF buffer.
- gif_
frames π - Builds a bounded GIF frame iterator.
- png_
frames π - Builds a bounded APNG frame iterator.
- source_
frames π - The frame sequence a picture carries, and what one frame of it costs.
- webp_
frames π - Builds a bounded WebP frame iterator.