{"id":26949656,"url":"https://github.com/catdad-experiments/svg-render","last_synced_at":"2025-04-02T22:16:58.237Z","repository":{"id":48481476,"uuid":"240384230","full_name":"catdad-experiments/svg-render","owner":"catdad-experiments","description":"👤 render high-quality png images from svg","archived":false,"fork":false,"pushed_at":"2024-04-27T17:38:34.000Z","size":31,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-08T07:53:47.184Z","etag":null,"topics":["canvas","cli","nodejs","png","svg","svg-icons"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catdad-experiments.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-13T22:57:48.000Z","updated_at":"2024-04-27T17:16:56.000Z","dependencies_parsed_at":"2024-04-27T17:28:26.793Z","dependency_job_id":"8b069d0f-d381-4c96-8768-11e54322c837","html_url":"https://github.com/catdad-experiments/svg-render","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"80ad11f4df22c3da3009ac5bb3843c63b65755fa"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catdad-experiments%2Fsvg-render","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catdad-experiments%2Fsvg-render/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catdad-experiments%2Fsvg-render/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catdad-experiments%2Fsvg-render/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catdad-experiments","download_url":"https://codeload.github.com/catdad-experiments/svg-render/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246899656,"owners_count":20851899,"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":["canvas","cli","nodejs","png","svg","svg-icons"],"created_at":"2025-04-02T22:16:57.754Z","updated_at":"2025-04-02T22:16:58.230Z","avatar_url":"https://github.com/catdad-experiments.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svg-render\n\n\u003e Render high-quality PNG images from an SVG\n\n[![CI][ci.svg]][ci.link]\n[![npm-downloads][npm-downloads.svg]][npm.link]\n[![npm-version][npm-version.svg]][npm.link]\n\n[ci.svg]: https://github.com/catdad-experiments/svg-render/actions/workflows/ci.yml/badge.svg\n[ci.link]: https://github.com/catdad-experiments/svg-render/actions/workflows/ci.yml\n[npm-downloads.svg]: https://img.shields.io/npm/dm/svg-render.svg\n[npm.link]: https://www.npmjs.com/package/svg-render\n[npm-version.svg]: https://img.shields.io/npm/v/svg-render.svg\n\n## CLI\n\nThe easiest way to convert your SVG to a PNG is on the command line:\n\n```bash\nnpx svg-render \u003c input.svg \u003e output.png\n```\n\nYou can also resive your SVG, since it is scalable after all:\n\n```bash\nnpx svg-render --width 512 \u003c input.svg \u003e output.png\n```\n\nSee `npx svg-render --help` for more info.\n\nIf you use this often, you might benefit from installing it on your path directly:\n\n```bash\nnpm install --global svg-render\n\nsvg-render \u003c input.svg \u003e output.png\n```\n\nThe generated images are unoptimized. You can optimize them with something like [`pngmin-cli`](https://github.com/catdad-experiments/pngmin-cli):\n\n```bash\nnpx svg-render \u003c input.svg | npx pngmin-cli \u003e output.png\n```\n\n## API\n\nYou can require this module in your script as well:\n\n```javascript\nconst { promises: fs } = require('fs');\nconst render = require('svg-render');\n\n(async () =\u003e {\n  const outputBuffer = await render({\n    buffer: await fs.readFile('/path/to/my/input.svg'),\n    width: 512\n  });\n\n  await fs.writeFile('./output.png', outputBuffer);\n})();\n```\n\nOptions:\n* `buffer` _`\u003cBuffer\u003e`_: Required. The SVG being rendered.\n* `width` _`\u003cNumber\u003e`_: Optional. The desired width of the output PNG. Defaults to the width defined in the SVG (or proportionally scaled based on `height` when defined).\n* `height` _`\u003cNumber\u003e`_: Optional. The desired height of the output PNG. Defaults to the height defined in the SVG (or proportionally scaled based on `width` when defined).\n\n_Note: both `width` and `height` are optional, but they work together. If neither is provided, the PNG will be the original size of the SVG. If only one of the properties is provided, the other will automatically be scaled proportionally to the original SVG size. If both are provided, the PNG will be stretched to that exact size, regardless of proportions._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatdad-experiments%2Fsvg-render","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatdad-experiments%2Fsvg-render","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatdad-experiments%2Fsvg-render/lists"}