Branding Asset Builder
asset_builder.py generates website image assets from PNG, JPG, and JPEG source files.
On this page ▾
Asset Builder for Cloudflare R2
Branding Asset Builder
It supports both a directory and a single image as the source.
Usage
Process all supported images under a directory:
python scripts/branding/asset_builder.py \
--source webapp/frontend/static/assets/images/
`Process a single image:
python scripts/branding/asset_builder.py \
--source webapp/frontend/static/assets/email.pngA custom output directory can also be provided:
python scripts/branding/asset_builder.py \
--source webapp/frontend/static/assets/images/ \
--generated /tmp/generatedImage 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:
[64, 72, 80, 96, 120, 128, 144, 152, 160, 167, 180, 192, 240, 256, 384, 512]Favicon sizes:
[16, 32, 48]Name/logo widths:
[120, 180, 240, 320, 480, 512, 640, 768, 960, 1024, 1280, 1536, 2048]Generated directory structure
By default, generated assets are written under:
static/generated/The directory structure is preserved relative to static/assets.
For example:
static/assets/
├── images/
│ └── signatures/
│ ├── signature_image_1.png
│ └── signature_image_2.png
└── email.pnggenerates:
static/generated/
├── images/
│ └── signatures/
│ ├── signature_image_1-120.png
│ └── signature_image_1-180.png
└── email-120.pngWhen 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:
python scripts/branding/asset_builder.py \
--source webapp/frontend/static/assets/images/signatures/processes only images/signatures/ and generates its assets under:
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.