--- since: 1.2.1 --- ### Asset Builder for Cloudflare R2 ## Branding Asset Builder `asset_builder.py` generates website image assets from PNG, JPG, and JPEG source files. It supports both a directory and a single image as the source. ### Usage Process all supported images under a directory: ```bash python scripts/branding/asset_builder.py \ --source webapp/frontend/static/assets/images/ ```` Process a single image: ```bash python scripts/branding/asset_builder.py \ --source webapp/frontend/static/assets/email.png ``` A custom output directory can also be provided: ```bash python scripts/branding/asset_builder.py \ --source webapp/frontend/static/assets/images/ \ --generated /tmp/generated ``` ### Image handling Images are classified automatically: * Square images → icon assets, favicons, and Apple touch icon. * Non-square images → width-based PNG variants. * Supported formats: `.png`, `.jpg`, `.jpeg` * SVG is currently ignored and is planned for a separate pipeline. Icon sizes: ```text [64, 72, 80, 96, 120, 128, 144, 152, 160, 167, 180, 192, 240, 256, 384, 512] ``` Favicon sizes: ```text [16, 32, 48] ``` Name/logo widths: ```text [120, 180, 240, 320, 480, 512, 640, 768, 960, 1024, 1280, 1536, 2048] ``` ### Generated directory structure By default, generated assets are written under: ```text static/generated/ ``` The directory structure is preserved relative to `static/assets`. For example: ```text static/assets/ ├── images/ │ └── signatures/ │ ├── signature_image_1.png │ └── signature_image_2.png └── email.png ``` generates: ```text static/generated/ ├── images/ │ └── signatures/ │ ├── signature_image_1-120.png │ └── signature_image_1-180.png └── email-120.png ``` When a subdirectory is supplied as `--source`, only images within that directory are processed, while their original path under `assets` is preserved in `generated`. For example: ```bash python scripts/branding/asset_builder.py \ --source webapp/frontend/static/assets/images/signatures/ ``` processes only `images/signatures/` and generates its assets under: ```text static/generated/images/signatures/ ``` Existing generated files and directories are preserved. Generated files with the same path/name are overwritten, while unrelated generated directories remain untouched.