Crate svg_metadata

Source
Expand description

svg_metadata is a Rust crate for parsing metadata information of SVG files.

In can be useful for getting information from SVG graphics without using a full-blown parser. As such, it has a very narrow scope and only provides access to the fields defined below.

§Usage Example

use svg_metadata::{Metadata, ViewBox};

let svg = r#"
    <svg viewBox="0 1 99 100" xmlns="http://www.w3.org/2000/svg">
        <rect x="0" y="0" width="100%" height="100%"/>
    </svg>
"#;

let meta = Metadata::parse(svg).unwrap();
assert_eq!(
    meta.view_box,
    Some(ViewBox {
        min_x: 0.0,
        min_y: 1.0,
        width: 99.0,
        height: 100.0
    })
);

Structs§

Height
Specifies the height of an SVG image.
Metadata
Contains all metadata that was extracted from an SVG image.
ViewBox
Specifies the dimensions of an SVG image.
Width
Specifies the width of an SVG image.

Enums§

Unit
Supported units for dimensions