Convert Android vector drawable XML files to Apple's Asset Catalog format
Project description
vectorToApple
Overview
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.
Installation
To install vectortoapple you can use pip, the Python package manager. Follow the steps below:
Prerequisites
Make sure you have Python 3.6 or higher installed on your system. You can download it from python.org.
Install via PyPI
You can install vectortoapple directly from the Python Package Index (PyPI) using the following command:
pip install vectortoapple
Install from Source
If you prefer to install from the source, you can clone the repository and install it manually:
-
Clone the repository:
git clone https://github.com/yourusername/vectortoapple.git cd vectortoapple
-
Install the package:
pip install .
Install Development Dependencies
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
Features
- 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.
Requirements
- Python 3.x
cairosvglibraryPIL(Pillow) librarytqdmlibrary- Node.js with
npxinstalled vector-drawable-svgpackage
Setup
- 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
Usage
After installing vectortoapple, you can use it from the command line. Simply run the following command:
vectortoapple
Output
The 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.
Contributing
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.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vectortoapple-0.1.0.tar.gz.
File metadata
- Download URL: vectortoapple-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8706c9126ba1718dc1b6887601a78c3a88ed87784733141fc2b042a0ebb4f1d8
|
|
| MD5 |
6464225a8c11d534a3b47ff57493ee68
|
|
| BLAKE2b-256 |
d41b16b8a19af089535855575fc3303e6b437660bc4f4ad2f61d19fc0fdf02bf
|
File details
Details for the file vectortoapple-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vectortoapple-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17acd3f5c56714e8aed4d4f162c1f3fa2bbe6a69a171c68f7e47baf6ac438d8c
|
|
| MD5 |
fc4171f9049bc9e566401e716837b043
|
|
| BLAKE2b-256 |
98a6bbe80c30228e6c0a81c467a9bd391744b38655c62c711bff49cc5c9be5db
|