11 unstable releases (5 breaking)

0.28.5 Oct 2, 2023
0.28.4 Mar 25, 2023
0.28.3 Feb 21, 2023
0.27.0 Jan 23, 2023
0.23.0 Sep 4, 2022

#468 in Images

Download history 32/week @ 2023-07-25 6/week @ 2023-08-01 10/week @ 2023-08-08 22/week @ 2023-08-15 19/week @ 2023-08-22 5/week @ 2023-08-29 23/week @ 2023-09-05 9/week @ 2023-09-12 17/week @ 2023-09-19 47/week @ 2023-09-26 34/week @ 2023-10-03 10/week @ 2023-10-10 15/week @ 2023-10-17 16/week @ 2023-10-24 17/week @ 2023-10-31 23/week @ 2023-11-07

71 downloads per month
Used in 2 crates

MPL-2.0 license

10K SLoC


Crates.io Documentation Rust 1.51+

usvg (micro SVG) is an SVG parser that tries to solve most of SVG complexity.

SVG is notoriously hard to parse. usvg presents a layer between an XML library and a potential SVG rendering library. It will parse an input SVG into a strongly-typed tree structure were all the elements, attributes, references and other SVG features are already resolved and presented in a simplest way possible. So a caller doesn't have to worry about most of the issues related to SVG parsing and can focus just on the rendering part.


  • All supported attributes are resolved. No need to worry about inheritable, implicit and default attributes
  • CSS will be applied
  • Only simple paths
    • Basic shapes (like rect and circle) will be converted into paths
    • Paths contain only absolute MoveTo, LineTo, CurveTo and ClosePath segments. ArcTo, implicit and relative segments will be converted
  • use will be resolved and replaced with the reference content
  • Nested svg will be resolved
  • Invalid, malformed elements will be removed
  • Relative length units (mm, em, etc.) will be converted into pixels/points
  • External images will be loaded
  • Internal, base64 images will be decoded
  • Dummy groups will be removed
  • All references (like #elem and url(#elem)) will be resolved
  • switch will be resolved
  • Text elements, which are probably the hardest part of SVG, will be completely resolved. This includes all the attributes resolving, whitespaces preprocessing (xml:space), text chunks and spans resolving
  • Markers will be converted into regular elements. No need to place them manually
  • All filters are supported. Including filter functions, like filter="contrast(50%)"
  • Recursive elements will be detected an removed


  • Unsupported SVG features will be ignored
  • CSS support is minimal
  • Only static SVG features, e.g. no a, view, cursor, script, no events and no animations


usvg is licensed under the MPLv2.0.


~39K SLoC