MCPcopy Create free account
hub / github.com/acking-you/static_flow / encode_thumbnail

Function encode_thumbnail

crates/cli/src/utils.rs:109–114  ·  view source on GitHub ↗
(image: &DynamicImage, size: u32)

Source from the content-addressed store, hash-verified

107}
108
109pub fn encode_thumbnail(image: &DynamicImage, size: u32) -> Result<Vec<u8>> {
110 let thumbnail = image.thumbnail(size, size);
111 let mut buffer = std::io::Cursor::new(Vec::new());
112 thumbnail.write_to(&mut buffer, ImageFormat::Png)?;
113 Ok(buffer.into_inner())
114}
115
116pub fn collect_image_files(dir: &Path, recursive: bool) -> Result<Vec<PathBuf>> {
117 let mut files = Vec::new();

Callers 3

runFunction · 0.85
build_image_recordFunction · 0.85
build_image_recordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected