Skip to main content

Module generate

Module generate 

Source
Expand description

Generates and stores still and animated thumbnail variants.

Re-exportsΒ§

use std::cmp::min; πŸ”’
use std::io::Cursor; πŸ”’
use image::DynamicImage; πŸ”’
use image::ImageFormat; πŸ”’
use image::ImageReader; πŸ”’
use image::Limits; πŸ”’
use image::imageops::FilterType; πŸ”’
use ruma::Mxc; πŸ”’
use ruma::http_headers::ContentDisposition; πŸ”’
use ruma::http_headers::ContentDispositionType; πŸ”’
use ruma::media::Method; πŸ”’
use tuwunel_core::Err; πŸ”’
use tuwunel_core::Result; πŸ”’
use tuwunel_core::err; πŸ”’
use tuwunel_core::implement; πŸ”’
use tuwunel_core::utils::BoolExt; πŸ”’
use super::super::Media; πŸ”’
use super::super::data::Metadata; πŸ”’
use super::Animate; πŸ”’
use super::Dim; πŸ”’
use super::request::into_media; πŸ”’
use super::sniff::Sequence; πŸ”’
use super::sniff::sequence; πŸ”’

ConstantsΒ§

BYTES_PER_PIXEL πŸ”’
Bytes the decoder is budgeted per pixel of the picture it is asked for.
PNG πŸ”’
Content type of every still thumbnail tuwunel generates.
STILL_NAME πŸ”’
Filename a generated still thumbnail is disposed under, per the media repository specification, rather than the source filename.

FunctionsΒ§

animates_at πŸ”’
Whether this source yields an animated variant at these dimensions.
decoder_limits πŸ”’
Creates decoder limits from the configured pixel budget.
encode_png πŸ”’
Encodes one still thumbnail into a PNG buffer.
header_dim πŸ”’
The dimensions this picture’s own header declares.
limited_reader πŸ”’
Creates an image reader with the configured allocation limit.
picture_dim πŸ”’
The size a picture that may not be served stands in at.
reader πŸ”’
Creates an image reader for encoded picture bytes.
thumbnail_generate πŸ”’
Resizes a decoded picture to the requested dimensions.