This is a simple python script to convert a svg path to an android ImageVector. I use it to create icons programmatically for my Jetpack Compose projects.
Basic Usage:
python convert_svg_path_to_image_vector.py -n '<name>' -p '<package>' -t '<type>' -d '<path_data>'
With:
- name: Name of the icon and file
- package: Your app package
- type: Type of the icon (Filled, Rounded, ...)
- path_data: SVG path data (e.g. "M1,1L2,2z")
- Converts it to a ready to use Kotlin file
- Accepts mutiple data sets per SVG identifier (e.g. "L1,1 2,2z", will be parsed as "L1,1L2,2z")
- Automatically appends a close to the path if no "z" identifier is at the end
Developed by philipk99 (Philip) 2025.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.