{"id":13418855,"url":"https://github.com/piqnt/svgexport","last_synced_at":"2025-12-17T19:52:33.100Z","repository":{"id":21055986,"uuid":"24355141","full_name":"piqnt/svgexport","owner":"piqnt","description":"SVG to PNG/JPEG command-line tool and Node.js module","archived":false,"fork":false,"pushed_at":"2025-04-03T17:12:45.000Z","size":116,"stargazers_count":944,"open_issues_count":56,"forks_count":88,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-06-20T19:19:22.907Z","etag":null,"topics":["cli","command-line","javascript","jpeg","png","rasterizer","svg"],"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/piqnt.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,"zenodo":null}},"created_at":"2014-09-23T03:18:11.000Z","updated_at":"2025-06-14T12:32:07.000Z","dependencies_parsed_at":"2025-05-03T13:01:35.989Z","dependency_job_id":null,"html_url":"https://github.com/piqnt/svgexport","commit_stats":null,"previous_names":["shakiba/svgexport"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/piqnt/svgexport","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piqnt%2Fsvgexport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piqnt%2Fsvgexport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piqnt%2Fsvgexport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piqnt%2Fsvgexport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piqnt","download_url":"https://codeload.github.com/piqnt/svgexport/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piqnt%2Fsvgexport/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261073398,"owners_count":23105643,"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":["cli","command-line","javascript","jpeg","png","rasterizer","svg"],"created_at":"2024-07-30T22:01:07.969Z","updated_at":"2025-12-17T19:52:28.033Z","avatar_url":"https://github.com/piqnt.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# svgexport\n\nsvgexport is a Node.js module and command-line tool for exporting SVG files to PNG and JPEG, it uses Puppeteer for rendering SVG files.\n\n### Command Line\n\n#### Installation\n```\nnpm install svgexport -g\n```\n\n#### Installation Issues\nYou might encounter an error while installing because of a puppeteer issue documented here\n[puppeteer/puppeteer#367](https://github.com/puppeteer/puppeteer/issues/367)\n\nTo circumvent this, you will need the following command\n```\nsudo npm install -g svgexport --unsafe-perm=true\n```\n\n#### Usage\n```usage\nsvgexport \u003cinput file\u003e \u003coutput file\u003e \u003coptions\u003e\nsvgexport \u003cdatafile\u003e\n\n\u003coptions\u003e        [\u003cformat\u003e] [\u003cquality\u003e] [\u003cinput viewbox\u003e] [\u003coutput size\u003e] [\u003cresize mode\u003e] [\u003cstyles\u003e]\n\n\u003cformat\u003e         png|jpeg|jpg\n                 If not specified, it will be inferred from output file extension or defaults to \"png\".\n\n\u003cquality\u003e        1%-100%\n\n\u003cinput viewbox\u003e  \u003cleft\u003e:\u003ctop\u003e:\u003cwidth\u003e:\u003cheight\u003e|\u003cwidth\u003e:\u003cheight\u003e\n                 If input viewbox is not specified it will be inferred from input file.\n\n\u003coutput size\u003e    \u003cscale\u003ex|\u003cwidth\u003e:\u003cheight\u003e|\u003cwidth\u003e:|:\u003cheight\u003e\n                 If output size is specified as width:height, \u003cviewbox mode\u003e is used.\n\n\u003cviewbox mode\u003e   crop|pad\n                 Crop (slice) or pad (extend) input to match output aspect ratio, default mode is \"crop\".\n\n\u003cdatafile\u003e       Path of a JSON file with following content:\n                 [ {\n                   \"input\" : [\"\u003cinput file\u003e\", \"\u003coption\u003e\", \"\u003coption\u003e\", ...],\n                   \"output\": [ [\"\u003coutput file\u003e\", \"\u003coption\u003e\", \"\u003coption\u003e\", ...] ]\n                 }, ...]\n                 Input file options are merged with and overridden by output file options.\n                 Instead of a JSON file, a Node module which exports same content can be provided.\n```\n\n#### Examples\n\nScale 1.5x proportionally:\n```\nsvgexport input.svg output.png 1.5x\n```\n\nScale proportionally to set output width to 32px:\n```\nsvgexport input.svg output.png 32:\n```\n\nScale proportionally and pad output to set output width:height to 32px:54px:\n```\nsvgexport input.svg output.png pad 32:54\n```\n\nExport `-1:-1:24:24` (`left:top:width:height`) of input.svg to output.png:\n```\nsvgexport input.svg output.png -1:-1:24:24 1x\n```\n\nSet output JPEG quality:\n```\nsvgexport input.svg output.jpg 80%\n```\n\nUse a CSS to style input SVG:\n```\nsvgexport input.svg output.jpg \"svg{background:silver;}\"\n```\n\nBy default, Puppeteer has a page load timeout of 30 seconds. This might not be\nenough for large SVG files. If you want to change the page timeout, set the\n`SVGEXPORT_TIMEOUT` environment variable to the desired number of seconds.\n```bash\n// One minute timeout\nSVGEXPORT_TIMEOUT=60 svgexport input.svg output.png\n```\n\n### Node.js Module\n\n#### Installation\n```\nnpm install svgexport --save\n```\n\n#### Usage\n\n```javascript\nvar svgexport = require('svgexport');\n\nsvgexport.render(datafile, callback);\n```\n`datafile` can be an object, an array of objects or a JSON file path, see command line usage for its format.\n\n### Contributors\n\nsvgexport was migrated from PhantomJS to Puppeteer by [Michael Heerklotz](https://github.com/MichaelHeerklotz).\n\n### License\n\nCopyright (c) 2016 Ali Shakiba\nAvailable under the MIT license\n\n*Keywords: svg, export, rasterize, converter, png, jpeg, jpg, cli, command-line, inkscape, illustrator, coreldraw*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiqnt%2Fsvgexport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiqnt%2Fsvgexport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiqnt%2Fsvgexport/lists"}