This Python project generates icons and splash screens for Progressive Web Apps (PWA) from a base image. It automatically resizes the base image into the required sizes for both splash screens and icons, making the setup process for your PWA faster and more efficient.
- Generates multiple splash screen sizes for various devices.
- Creates icons in different sizes, ready to be used in your PWA manifest.
- Simple command-line interface for generating images.
- Python 3.x
- Pillow library for image manipulation
-
Clone the repository:
git clone https://github.com/bemtorres/pwa-icon-maker.git cd pwa-icon-maker -
Create a virtual environment (optional but recommended):
python -m venv virtualenv
-
Activate the virtual environment:
- On Windows (CMD):
virtualenv\Scripts\activate
- On Windows (PowerShell):
virtualenv\Scripts\Activate.ps1
- On macOS/Linux:
source virtualenv/bin/activate
- On Windows (CMD):
-
Install the required dependencies:
pip install -r requirements.txt
-
Deactivate the virtual environment when done:
deactivate
-
Place your base image (e.g.,
base_image.png) in the project root directory. -
Run the script to generate the icons and splash screens:
python generate_images.py
-
The generated images will be saved in the following directories:
- Splash screens:
./images/icons/splash/ - Icons:
./images/icons/
- Splash screens:
The script generates the following image sizes:
640x1136750x1334828x17921125x24361242x22081242x26881536x20481668x22241668x23882048x2732
72x7296x96128x128144x144152x152192x192384x384512x512
You can modify the splash_sizes and icon_sizes dictionaries in generate_images.py to add or change image dimensions based on your specific requirements.
To test the script:
-
Ensure that you have a base image (e.g.,
base_image.png) in the project root directory. -
Run the script:
python generate_images.py python _test/test_generate_images.py
-
Verify that the output images have been correctly generated in the
./images/icons/splash/and./images/icons/directories.
This project is licensed under the MIT License. See the LICENSE file for details.
### Instrucciones de prueba
1. **Preparación**:
- Coloca una imagen base con el nombre `base_image.png` en el directorio raíz del proyecto.
- Asegúrate de tener instalada la librería `Pillow`.
2. **Prueba**:
- Ejecuta el siguiente comando en la terminal:
```bash
python generate_images.py
```
3. **Verificación**:
- Revisa que los íconos y pantallas splash se hayan generado correctamente en los directorios `./images/icons/` y `./images/icons/splash/`.
- Verifica que los archivos tengan los tamaños adecuados y estén en formato `.png`.
Este `README.md` es ideal para subirlo a GitHub y proporcionar una visión clara del proyecto y su uso. Además, las instrucciones de prueba ayudan a verificar que todo funcione correctamente.