{"id":28073333,"url":"https://github.com/RazrFalcon/resvg","last_synced_at":"2025-05-12T22:01:55.905Z","repository":{"id":38419109,"uuid":"72125332","full_name":"linebender/resvg","owner":"linebender","description":"An SVG rendering library.","archived":false,"fork":false,"pushed_at":"2025-04-19T16:32:40.000Z","size":18451,"stargazers_count":3119,"open_issues_count":105,"forks_count":253,"subscribers_count":35,"default_branch":"main","last_synced_at":"2025-05-06T19:51:56.763Z","etag":null,"topics":["render","svg"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linebender.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-10-27T16:07:55.000Z","updated_at":"2025-05-06T02:50:26.000Z","dependencies_parsed_at":"2023-01-31T03:32:29.849Z","dependency_job_id":"9596048b-8e43-491f-a1c0-5aa6363d38f0","html_url":"https://github.com/linebender/resvg","commit_stats":{"total_commits":910,"total_committers":41,"mean_commits":"22.195121951219512","dds":0.06263736263736264,"last_synced_commit":"87f53793b2eb21111bbc34704919067e631cf3f7"},"previous_names":["linebender/resvg","razrfalcon/resvg"],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linebender%2Fresvg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linebender%2Fresvg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linebender%2Fresvg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linebender%2Fresvg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linebender","download_url":"https://codeload.github.com/linebender/resvg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253830925,"owners_count":21971001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["render","svg"],"created_at":"2025-05-12T22:01:39.365Z","updated_at":"2025-05-12T22:01:55.854Z","avatar_url":"https://github.com/linebender.png","language":"Rust","funding_links":[],"categories":["Applications","应用","应用程序 Applications","Rust"],"sub_categories":["Graphics","图像","图形 Graphics"],"readme":"## resvg\n![Build Status](https://github.com/linebender/resvg/workflows/Build/badge.svg)\n[![Crates.io](https://img.shields.io/crates/v/resvg.svg)](https://crates.io/crates/resvg)\n[![Documentation](https://docs.rs/resvg/badge.svg)](https://docs.rs/resvg)\n[![Rust 1.67.1+](https://img.shields.io/badge/rust-1.67.1+-orange.svg)](https://www.rust-lang.org)\n\n*resvg* is an [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) rendering library.\n\nIt can be used as a Rust library, as a C library, and as a CLI application to render static SVG files.\n\nThe core idea is to make a fast, small, portable SVG library with the goal to support the whole SVG spec.\n\n## Features\n\n### Designed for edge-cases\n\nSVG is a very complicated format with a large specification (SVG 1.1 is almost 900 pages).\nYou basically need a web browser to handle all of it. But the truth is that even browsers\nfail at this (see [SVG support](https://github.com/linebender/resvg#svg-support)).\nYes, unlike `resvg`, browsers do support dynamic SVG features like animations and scripting.\nBut using a browser to render SVG _correctly_ is sadly not an option.\n\nTo prove its correctness, `resvg` has a vast test suite that includes around 1600 tests.\nAnd those are only SVG-to-PNG regression tests. This doesn't include tests in `resvg` dependencies.\nAnd the best thing is that `resvg` test suite is available to everyone. It's not tied to `resvg`\nin any way. Which should help people who plan to develop their own SVG libraries.\n\n### Safety\n\nIt's hard not to mention safety when we talk about Rust and processing of a random input.\nAnd we're talking not only about SVG/XML, but also about CSS, TTF, PNG, JPEG, GIF, and GZIP.\n\nWhile `resvg` is not the only SVG library written in Rust, it's the only one that\nis written completely in Rust. There is no non-Rust code in the final binary.\n\nMoreover, there is almost no `unsafe` code either. Still, some dependencies have some `unsafe` code\nand font memory-mapping is inherently `unsafe`, but it's best you can get in terms of memory safety.\n\nHowever, this doesn't stop at memory safety. `resvg` has extensive checks to prevent endless loops (freezes)\nand stack overflows (via recursion).\n\n### Zero bloat\n\nRight now, the `resvg` CLI application is less than 3MB in size and doesn't require any external dependencies.\nThe binary contains nothing that isn't needed for rendering SVG files.\n\n### Portable\n\n`resvg` is guaranteed to work everywhere where you can compile the Rust itself,\nincluding WASM. There are some rough edges with obscure CPU architectures and\nmobile OSs (mainly system fonts loading), but it should be pretty painless otherwise.\n\n### SVG preprocessing\n\nAnother major difference from other SVG rendering libraries is that in `resvg`\nSVG parsing and rendering are two completely separate steps.\nThose steps are also split into two separate libraries: `resvg` and [usvg].\nMeaning you can easily write your own renderer on top of `usvg` using any 2D library of your liking.\n\n### Performance\n\nComparing performance between different SVG rendering libraries is like comparing apples and oranges.\nEveryone has a very different set of supported features, languages, build flags, etc...\nAnyhow, as `resvg` is written in Rust and uses [tiny-skia] for rendering - it's pretty fast.\nThere should also still be quite a lot of room for improvement.\n\n### Reproducibility\n\nSince `resvg` doesn't rely on any system libraries it allows us to have reproducible results\non all supported platforms. Meaning if you render an SVG file on x86 Windows and then render it\non ARM macOS - the produced image will be identical. Each pixel would have the same value.\n\n## Limitations\n\n- No animations\u003cbr\u003e\n  There are no plans on implementing them either.\n- No native text rendering\u003cbr\u003e\n  `resvg` doesn't rely on any system libraries, which implies that we cannot use native text rendering.\n  Nevertheless, native text rendering is optimized for small horizontal text, which is not\n  that common in SVG.\n- Unicode-only\u003cbr\u003e\n  It's the 21st century. Text files that aren't UTF-8 encoded are no longer relevant.\n\n## SVG support\n\n`resvg` aims to only support the [static](http://www.w3.org/TR/SVG11/feature#SVG-static)\nSVG subset; i.e. no `a`, `script`, `view` or `cursor` elements, no events and no animations.\n\n[SVG 2](https://www.w3.org/TR/SVG2/) support is being worked on.\nYou can search for relevant issues with the\n[svg2 tag](https://github.com/linebender/resvg/issues?q=is%3Aissue+is%3Aopen+label%3Asvg2)\nor our [SVG 2 changelog](https://github.com/linebender/resvg/blob/main/docs/svg2-changelog.md).\n\n[SVG Tiny 1.2](https://www.w3.org/TR/SVGTiny12/) is not supported and support is also not planned.\n\nResults of the [resvg test suite](https://github.com/linebender/resvg-test-suite):\n\n![](./.github/chart.svg)\n\nSVG 2 only results:\n\n![](./.github/chart-svg2.svg)\n\nYou can find a complete table of supported features\n[here](https://linebender.org/resvg-test-suite/svg-support-table.html).\nIt also includes some alternative libraries.\n\nWe're not testing against all SVG libraries since many of them are pretty bad.\nSome libraries are not on the list because they don't pass the 25% mark.\nSuch libraries are: wxSvg, LunaSVG and nanosvg.\n\n## resvg project\n\nThere is a subtle difference between resvg as a _library_ and resvg as a _project_.\nWhile most users will interact only with the resvg library, it's just a tip of an iceberg.\nThere are a lot of libraries that I had to write to make resvg possible.\nHere are some of them:\n\n- resvg - the actual SVG renderer\n- [usvg] - an SVG preprocessor/simplifier\n- [tiny-skia] - a [Skia](https://github.com/google/skia) subset ported to Rust\n- [rustybuzz] - a [harfbuzz](https://github.com/harfbuzz/harfbuzz) subset ported to Rust\n- [ttf-parser] - a TrueType/OpenType font parser\n- [fontdb] - a simple, in-memory font database with CSS-like queries\n- [roxmltree] - an XML parsing library\n- [simplecss] - a pretty decent CSS 2 parser and selector\n- [pico-args] - an absolutely minimal, but surprisingly popular command-line arguments parser\n\nSo while the resvg _library_ is deceptively small (around 2500 LOC), the resvg _project_\nis nearing 75'000 LOC. Which is not that much considering how much resvg does.\nIt's definitely the smallest option out there.\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n## Contribution\n\nContributions are welcome by pull request.\nThe [Rust code of conduct] applies.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.\n\n[usvg]: https://github.com/linebender/resvg/tree/main/crates/usvg\n[rustybuzz]: https://github.com/harfbuzz/rustybuzz\n[tiny-skia]: https://github.com/linebender/tiny-skia\n[ttf-parser]: https://github.com/harfbuzz/ttf-parser\n[roxmltree]: https://github.com/RazrFalcon/roxmltree\n[simplecss]: https://github.com/linebender/simplecss\n[fontdb]: https://github.com/RazrFalcon/fontdb\n[pico-args]: https://github.com/RazrFalcon/pico-args\n[Rust Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRazrFalcon%2Fresvg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRazrFalcon%2Fresvg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRazrFalcon%2Fresvg/lists"}