{"id":13664960,"url":"https://github.com/sterlp/svg2png","last_synced_at":"2025-07-03T13:32:51.451Z","repository":{"id":38427620,"uuid":"51749514","full_name":"sterlp/svg2png","owner":"sterlp","description":"SVG to PNG converter, optimized for Android and iOS Apps","archived":false,"fork":false,"pushed_at":"2023-12-17T11:02:24.000Z","size":277,"stargazers_count":143,"open_issues_count":0,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-27T10:50:04.185Z","etag":null,"topics":["android","android-app","android-development","cli","flutter","flutter-apps","icons","ios-app","png","png-converter","svg","svg-files","svg-icons","svg2png"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sterlp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-02-15T10:55:11.000Z","updated_at":"2025-05-15T02:34:04.000Z","dependencies_parsed_at":"2022-08-09T04:00:52.726Z","dependency_job_id":"a330730b-8335-4547-8b4e-7bbddafd4e72","html_url":"https://github.com/sterlp/svg2png","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/sterlp/svg2png","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlp%2Fsvg2png","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlp%2Fsvg2png/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlp%2Fsvg2png/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlp%2Fsvg2png/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sterlp","download_url":"https://codeload.github.com/sterlp/svg2png/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlp%2Fsvg2png/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263335391,"owners_count":23450828,"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":["android","android-app","android-development","cli","flutter","flutter-apps","icons","ios-app","png","png-converter","svg","svg-files","svg-icons","svg2png"],"created_at":"2024-08-02T05:03:13.223Z","updated_at":"2025-07-03T13:32:51.422Z","avatar_url":"https://github.com/sterlp.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Free SVG to PNG converter \n\n![Java CI with Maven](https://github.com/sterlp/svg2png/workflows/Java%20CI%20with%20Maven/badge.svg?branch=master)\n[![huntr](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev)\n[![CodeQL](https://github.com/sterlp/svg2png/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/sterlp/svg2png/actions/workflows/codeql-analysis.yml)\n[![Maven](https://img.shields.io/maven-central/v/org.sterl.svg2png/svg2png)](https://central.sonatype.com/artifact/org.sterl.svg2png/svg2png)\n\n## Goal\nManage your Icons in SVG and generate the needed PNG into your projects as needed. No \"Web Service\" needed, just an executable JAR file. This library is based on [batik](https://xmlgraphics.apache.org/batik/)\n\n## Supported platforms\nOnly platforms with a full Java JRE are supported like:\n\n- Windows\n- Linux\n- Mac OS\n\n## Not supported platforms\n\n### Android\n\nBatik SVG Toolkit isn't supported by android because of the missing [Java2D API](https://stackoverflow.com/questions/7418937/how-to-integrate-batik-with-android-to-open-display-svg-files)\n\n## Tested Java distributions\n\n- zulu\n- graalvm\n\n\u003e temurin version 11 failed in the ci/cd build. \n\n- 1.2.x =\u003e JDK 8\n- 1.3.x =\u003e JDK 11\n\n## Download \u0026 Requirements\n\n* [Download latest release version of svg2png](https://github.com/puel/svg2png/releases)\n  * [Or from maven](https://central.sonatype.com/artifact/org.sterl.svg2png/svg2png)\n* You have to have Java 8 installed on your PC\n* Sidenote: [Google Android Icons](https://www.google.com/design/icons/)\n\n## CLI Options\n\n  \u003e **file:** Can be set for each file individually, see json config, or for all using a cli option. The name can be used in the files.\n\n| CLI | CLI long | Name      | Level      | Description      |\n| --- | -------- | --------- | ---------- | ---------------- |\n| w   | width    | width     | **file**   | Image width in pixel |\n| h   | height   | height    | **file**   | Image height in pixel |\n| n   | name     | name      | **file**   | Output name of the image |\n| o   | out-dir  | directory | **file**   | Output directory for this image |\n| | background-color   | backgroundColor    | **file**  | Provide a custom background color to use for opaque image formats e.g. 0077FF. |\n\n\n\n\n## CLI Usage\n\n```\n================================================================================\n                                   SVG to PNG                                   \n\nusage: svg2png\n -a,--no-alpha \u003carg\u003e           Saves PNG without alpha channel and with\n                               specified background hex triplet. (Needed\n                               for iOS assets.)\n    --android                  Android Icon 48dp mdpi 48x48 -\u003e xxxhdpi\n                               192x192.\n    --android-24dp             Android 24dp icons, with suffix _24dp --\n                               mdpi 24x24 -\u003e xxxhdpi 96x96.\n    --android-36dp             Android 36dp icons, with suffix _36dp --\n                               mdpi 36x36 -\u003e xxxhdpi 144x144.\n    --android-48dp             Android 48dp icons, with suffix _48dp --\n                               mdpi 48x48 -\u003e xxxhdpi 192x192.\n    --android-icon             Android Icon (Action Bar, Dialog etc.)\n                               config mdpi 36x36 -\u003e xxxhdpi 128x128.\n    --android-launch           Android Launcher Icon config mdpi 48x48 -\u003e\n                               xxxhdpi 192x192.\n    --android-small            Android Small default config from mdpi\n                               24x24 -\u003e xxxhdpi 96x96.\n    --background-color \u003carg\u003e   Provide a custom background color to use\n                               for opaque image formats e.g. 0077FF.\n -c,--config \u003carg\u003e             JSON Config file for the file output.\n -d,--in-dir \u003carg\u003e             Source directory with one or more files to\n                               convert.\n -e,--allow-external           Allow external entities to be loaded by the\n                               SVG.\n -f,--file \u003carg\u003e               Source file to convert.\n -h,--height \u003carg\u003e             Height of the output file.\n    --ios                      iOS icons and Contents.json.\n -n,--name \u003carg\u003e               New name to use for all output files.\n -o,--out-dir \u003carg\u003e            Output directory where to put the file.\n    --transparent-white        This is a trick so that viewers which do\n                               not support the alpha channel will see a\n                               white background (and not a black one).\n -w,--width \u003carg\u003e              Width of the output file.\n```\n\n## CLI Samples\n\n* use either **java -jar svg2png**\n* or download the executable jar and use **svg2png**\n\n```Shell\n# just convert one file, will create a foo.png as result\njava -jar svg2png.jar foo.svg\n\n# generate a PNG with a custom name\njava -jar svg2png.jar -f foo.svg -n bar.png\n\n# convert all files in a directory to a output directory\njava -jar svg2png.jar -d /Pictures/icons/svg -o /Pictures/icons/png\n\n# generate a 512x512 PNG\njava -jar svg2png.jar -w 512 -h 512 -f foo.svg\n\n# convert a directory with a JSON configuration\njava -jar svg2png.jar -d . -c my.json\n\n# convert SVG files using the default Android configuration\njava -jar svg2png.jar -d . -o /dev/workset/android-project/app/src/main/res --android\n\n# Convert all *.svg files in the current directory to 24dp android png files (generates drawable-* directories)\njava -jar svg2png.jar --android-small -d .\n\n# Convert 'my_picture.svg' using the android profile 48dp (generates drawable-* directories)\njava -jar svg2png.jar --android -f my_picture.svg\n\n# Converts 'my-logo.svg' as android logo 48dp, using ic_launcher.png as name, generates into mipmap-* directories\njava -jar svg2png.jar --android-launch -f my-logo.svg\n\n# convert all files in the directory '/Picures/icons/svg' and use '/Pictures/icons/png' as the output directory\njava -jar svg2png.jar -d /Picures/icons/svg -o /Pictures/icons/png\n\n# convert with a JSON configuration\njava -jar svg2png.jar -d . -c my.json\n\n# convert SVG to iOS icons with an orange background\njava -jar svg2png.jar -f foo.svg -n bar -o icons --ios --no-alpha ffbd33\n\n# select a custom background color\njava -jar svg2png.jar --background-color 6610f2 -f sample.svg\n```\n\n### JSON Android Config Sample\n\n```JSON\n{\n    \"files\": [\n        {\n            \"directory\": \"drawable-xxxhdpi\",\n            \"nameSuffix\": \"_24dp\",\n            \"height\": 96,\n            \"width\": 96\n        },{\n            \"directory\": \"drawable-xxhdpi\",\n            \"nameSuffix\": \"_24dp\",\n            \"height\": 72,\n            \"width\": 72\n        },{\n            \"directory\": \"drawable-xhdpi\",\n            \"nameSuffix\": \"_24dp\",\n            \"height\": 48,\n            \"width\": 48\n        },{\n            \"directory\": \"drawable-hdpi\",\n            \"nameSuffix\": \"_24dp\",\n            \"height\": 36,\n            \"width\": 36\n        },{\n            \"directory\": \"drawable-mdpi\",\n            \"nameSuffix\": \"_24dp\",\n            \"height\": 24,\n            \"width\": 24\n        }\n    ]\n}\n```\n\n# Links\n- https://developer.android.com/training/multiscreen/screendensities\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsterlp%2Fsvg2png","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsterlp%2Fsvg2png","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsterlp%2Fsvg2png/lists"}