Skip to main content

rasterize_from_bytes

Function rasterize_from_bytes 

Source
pub fn rasterize_from_bytes(
    svg: &[u8],
    target_size: Option<(u32, u32)>,
) -> Result<RasterResult, String>
Expand description

Parses SVG bytes and rasterizes them to straight-alpha RGBA pixels.

target_size fixes the output viewport. When None, the SVG’s intrinsic width/height (falling back to viewBox, then 300×150) determine the output size, matching resvg’s sizing behavior.