Skip to main content

block_from_path

Function block_from_path 

Source
pub fn block_from_path(path: &Path) -> Result<Option<Block>>
Expand description

Read path and produce an image block bounded by the caps above.

Untouched when it already fits. A small PNG is passed through byte for byte rather than round-tripped through a decoder — re-encoding a crisp screenshot of text as JPEG to no purpose is a real loss, and it is the exact case this is most often used for.

Returns Ok(None) when the extension is not one both backends read, so a caller can say “here is a path” for a PDF instead of failing.