vectortoapple is a Python tool that converts Android vector drawable XML files into iOS, tvOS, and universal-compatible image assets. It generates SVG and PNG files, scales them for different resolutions, and creates the necessary Contents.json files for Xcode asset catalogs.
To install vectortoapple you can use pip, the Python package manager. Follow the steps below:
Make sure you have Python 3.6 or higher installed on your system. You can download it from python.org.
You can install vectortoapple directly from the Python Package Index (PyPI) using the following command:
pip install vectortoappleIf you prefer to install from the source, you can clone the repository and install it manually:
-
Clone the repository:
git clone https://github.com/Ginder-Singh/vectortoapple.git cd vectortoapple -
Install the package:
pip install .
If you want to contribute to the development of vectortoapple, you may want to install the development dependencies. You can do this by creating a virtual environment and installing the requirements:
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
# Install development dependencies
pip install -r requirements.txt- Converts Android vector drawables to SVG format.
- Converts SVG files to PNG format with specified dimensions.
- Scales PNG images for 1x, 2x, and 3x resolutions.
- Generates
Contents.jsonfiles for asset organization.
- Python 3.x
cairosvglibraryPIL(Pillow) librarytqdmlibrary- Node.js with
npxinstalled vector-drawable-svgpackage
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
- Install required packages:
pip install cairosvg Pillow tqdm
After installing vectortoapple, you can use it from the command line. Simply run the following command:
vectortoappleThe script will create an .xcassets directory containing:
- SVG files for each vector drawable.
- PNG files scaled for 1x, 2x, and 3x (if applicable).
Contents.jsonfiles for each image set.
If you would like to contribute to vectortoapple, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes and commit them (
git commit -m 'Add new feature'). - Push to the branch (
git push origin feature-branch). - Create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.