{"id":26883721,"url":"https://github.com/jiro4989/svgo","last_synced_at":"2025-05-08T17:01:49.978Z","repository":{"id":80274233,"uuid":"244085729","full_name":"jiro4989/svgo","owner":"jiro4989","description":"This is svgo, a small utility to create SVG objects.","archived":false,"fork":false,"pushed_at":"2020-03-02T13:20:17.000Z","size":144,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T17:50:42.990Z","etag":null,"topics":["awk","cli","command","shell","svg"],"latest_commit_sha":null,"homepage":"","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jiro4989.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-03-01T04:21:16.000Z","updated_at":"2024-09-12T13:19:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"95f17850-ba8a-429c-9234-ee95602d05d6","html_url":"https://github.com/jiro4989/svgo","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiro4989%2Fsvgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiro4989%2Fsvgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiro4989%2Fsvgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiro4989%2Fsvgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiro4989","download_url":"https://codeload.github.com/jiro4989/svgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253112071,"owners_count":21856070,"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":["awk","cli","command","shell","svg"],"created_at":"2025-03-31T17:36:54.261Z","updated_at":"2025-05-08T17:01:49.875Z","avatar_url":"https://github.com/jiro4989.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"====\nsvgo\n====\n\n|nimble-version| |nimble-install| |gh-actions|\n\nThis is svgo, a small utility to create SVG objects.\nThis was inspired by `jpmens/jo \u003chttps://github.com/jpmens/jo\u003e`_.\n\n.. contents:: Table of contents\n\nUsage\n=====\n\nBasic usage\n-----------\n\n`-W` is a width of `svg` tag elements.\n`-H` is a height of `svg` tag elements.\nDefault values are `200`.\n\n.. code-block:: shell\n\n   $ svgo -W 400 -H 400 [ circle cx=200 cy=200 r=200 stroke=teal fill='#DDD' ]\n\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?\u003e\n   \u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n   \u003csvg version=\"1.1\" width=\"400\" xmlns=\"http://www.w3.org/2000/svg\" height=\"400\"\u003e\u003ccircle cy=\"200\" cx=\"200\" fill=\"#DDD\" stroke=\"teal\" r=\"200\" /\u003e\u003c/svg\u003e\n\nSave file. (`-o`)\n\n.. code-block:: shell\n\n   $ svgo -o out.svg [ circle cx=200 cy=200 r=200 stroke=teal fill='#DDD' ]\n\nNested elements.\n\n.. code-block:: shell\n\n   $ svgo [ g [ circle cx=100 cy=100 r=80 stroke=teal fill=\"#DDD\" ] [ circle cx=100 cy=100 r=80 stroke=teal fill=\"#DDD\" ] ]\n\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?\u003e\n   \u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n   \u003csvg version=\"1.1\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\" height=\"200\"\u003e\u003cg\u003e\n       \u003ccircle cy=\"100\" cx=\"100\" fill=\"#DDD\" stroke=\"teal\" r=\"80\" /\u003e\n       \u003ccircle cy=\"100\" cx=\"100\" fill=\"#DDD\" stroke=\"teal\" r=\"80\" /\u003e\n     \u003c/g\u003e\u003c/svg\u003e\n\nUse stdin fields. (`-i`)\n\n.. code-block:: shell\n\n   $ seq 0 25 100 | svgo [ circle cx=100 cy=100 r='$1' ] -i\n\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?\u003e\n   \u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n   \u003csvg version=\"1.1\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\" height=\"200\"\u003e\u003ccircle cy=\"100\" cx=\"100\" r=\"0\" /\u003e\u003c/svg\u003e\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?\u003e\n   \u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n   \u003csvg version=\"1.1\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\" height=\"200\"\u003e\u003ccircle cy=\"100\" cx=\"100\" r=\"25\" /\u003e\u003c/svg\u003e\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?\u003e\n   \u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n   \u003csvg version=\"1.1\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\" height=\"200\"\u003e\u003ccircle cy=\"100\" cx=\"100\" r=\"50\" /\u003e\u003c/svg\u003e\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?\u003e\n   \u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n   \u003csvg version=\"1.1\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\" height=\"200\"\u003e\u003ccircle cy=\"100\" cx=\"100\" r=\"75\" /\u003e\u003c/svg\u003e\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?\u003e\n   \u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n   \u003csvg version=\"1.1\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\" height=\"200\"\u003e\u003ccircle cy=\"100\" cx=\"100\" r=\"100\" /\u003e\u003c/svg\u003e\n\nAnimation GIF\n-------------\n\nYou can generate animation GIF with ImageMagick (`convert`).\n\n.. code-block:: shell\n\n   $ (seq 1 10 100; seq 100 -10 0) | svgo [ circle cx=100 cy=100 r='$1' ] -in -w 3 -o 'out_$NR.svg'\n   $ convert -density 1200 -resize 200x200 out_*.svg anim1.gif\n\n|image-demo-anim1|\n\n.. code-block:: shell\n\n   $ (seq 5 | awk '{print $1 * 40, 200}' | tee \u003e(awk '{print $2, $1}')) | svgo [ rect x=0 y=0 width='$1' height='$2' ] -ino 'out_$NR.svg'\n   $ convert -resize 200x200 out*.svg anim2.gif\n\n|image-demo-anim2|\n\n.. code-block:: shell\n\n   $ yes 'echo $((RANDOM % 200)) $((RANDOM % 200))' | head | bash | svgo [ circle cx='$1' cy='$2' r='50' ] -ino 'out_$NR.svg'\n   $ convert -resize 200x200 out*.svg anim3.gif\n\n|image-demo-anim3|\n\n.. code-block:: shell\n\n   $ seq -f 'obase=16; ibase=10; %g' 0 15 | bc | awk '{print $1, \"0\", \"0\"}' | svgo [ circle cx=100 cy=100 fill='#$1$2$3' r=100 ] -ino 'out_$NR.svg'\n   $ convert -resize 200x200 out*.svg anim4.gif\n\n|image-demo-anim4|\n\n.. code-block:: shell\n\n   $ seq 0 16 360 | svgo [ g rotate='$1' [ rect x=0 y=0 width=100 height=100 ] ] -ino 'out_$NR.svg'\n   $ convert -resize 200x200 out*.svg anim5.gif\n\n|image-demo-anim5|\n\n.. code-block:: shell\n\n   $ seq 10 2 30 | svgo -i [ text x=0 y='$1' font-size='$1' TEXT=HelloWorld ] -no 'out_$NR.svg'\n   $ convert -resize 200x200 out*.svg anim6.gif\n\n|image-demo-anim6|\n\n.. code-block:: shell\n\n   $ r=100\n     j=0\n     for i in f47 d47 b47 947 747 547 347 147 047 027; do\n       j=$((j+1))\n       svgo [ circle cx=100 cy=100 r=$r fill=\"#$i\" ] \u003e out_$(printf %02d $j).svg\n       r=$((r-10))\n     done\n   $ convert out*.svg anim7.gif\n\n|image-demo-anim7|\n\nInstallation\n============\n\n.. code-block:: shell\n\n   $ nimble install -Y svgo\n\nor install binaries from `Releases \u003chttps://github.com/jiro4989/svgo/releases\u003e`_.\n\nSpecial variables\n=================\n\nField variables ($1, $2, ... $NF)\n---------------------------------\n\nRecords are read in stdin at a time, and stored in the field variables.\nThe record is split into fields which are stored in $1, $2, ..., $NF like `awk`\nwhen activate `-i (--use-stdin)` flag.\n\n.. code-block:: shell\n\n   $ seq 3 | svgo -i [ circle cx=100 cy=200 r='$1' ]\n\n   # equals\n\n   $ svgo [ circle cx=100 cy=200 r='1' ]\n   $ svgo [ circle cx=100 cy=200 r='2' ]\n   $ svgo [ circle cx=100 cy=200 r='3' ]\n\n.. code-block:: shell\n\n   $ seq 3 | awk '{print $1, $1*10}' | svgo -i [ circle cx='$1' cy='$2' r='$1' ]\n\n   # equals\n\n   $ svgo [ circle cx='1' cy='10' r='1' ]\n   $ svgo [ circle cx='2' cy='20' r='2' ]\n   $ svgo [ circle cx='3' cy='30' r='3' ]\n\nCurrent record number (NR)\n--------------------------\n\nTODO\n\n\nLICENSE\n=======\n\nMIT\n\nSee also\n========\n\n* `SVG 1.1 - W3C \u003chttps://www.w3.org/TR/SVG11/\u003e`_\n\n.. |image-demo-anim1| image:: ./docs/anim1.gif\n.. |image-demo-anim2| image:: ./docs/anim2.gif\n.. |image-demo-anim3| image:: ./docs/anim3.gif\n.. |image-demo-anim4| image:: ./docs/anim4.gif\n.. |image-demo-anim5| image:: ./docs/anim5.gif\n.. |image-demo-anim6| image:: ./docs/anim6.gif\n.. |image-demo-anim7| image:: ./docs/anim7.gif\n\n.. |gh-actions| image:: https://github.com/jiro4989/svgo/workflows/build/badge.svg\n   :target: https://github.com/jiro4989/svgo/actions\n.. |nimble-version| image:: https://nimble.directory/ci/badges/svgo/version.svg\n   :target: https://nimble.directory/ci/badges/svgo/nimdevel/output.html\n.. |nimble-install| image:: https://nimble.directory/ci/badges/svgo/nimdevel/status.svg\n   :target: https://nimble.directory/ci/badges/svgo/nimdevel/output.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiro4989%2Fsvgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiro4989%2Fsvgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiro4989%2Fsvgo/lists"}