thumbcache

Crates.iothumbcache
lib.rsthumbcache
version0.2.1
sourcesrc
created_at2024-08-27 13:08:49.228683+00
updated_at2025-01-25 20:13:45.992076+00
descriptionGet file thumbnail on Windows
homepagehttps://github.com/yhdgms1/thumbcache
repositoryhttps://github.com/yhdgms1/thumbcache
max_upload_size
id1353373
size10,351
Artemiy Schukin (yhdgms1)

documentation

README

thumbcache

Uses Windows thumbcache to get bmp preview for a file.

Usage

When trying to get preview from file that is not an image (.zip or .exe) will gibe error. May also give error if preview does not exists.

use std::io::{Error, Write};

pub fn main() -> Result<(), Error> {
  let bmp = thumbcache::get_bmp(r"C:\path-to-file.jpeg", 96, 96)?;
  
  let mut file_out = std::fs::File::create("./out.bmp")?;
  let _ = file_out.write_all(&bmp);
  
  Ok(())
}

Sources

https://stackoverflow.com/questions/14207618/get-bytes-from-hbitmap

https://stackoverflow.com/questions/21751747/extract-thumbnail-for-any-file-in-windows

Commit count: 4

cargo fmt