# d13young/flipper-asset-studio architecture

> Architecture diagram of the GitHub repository d13young/flipper-asset-studio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/d13young/flipper-asset-studio
- Repository: https://github.com/d13young/flipper-asset-studio

## Overview

#### Purpose and entry points
Flipper Asset Studio is a cross-platform desktop authoring tool for Momentum Firmware/Flipper Zero graphic asset packs. It imports source images, edits animations or Passport icons, renders previews, exports Flipper-compatible files, and validates pack layouts. Runtime starts at `main.py`; the primary GUI composition root is `ui/main_window.py`. A script-oriented packer is also present at `scripts/asset_packer.py`.

#### Desktop UI shell and workflows
PyQt6 provides the application runtime and user-facing workflow routing. The main window hosts creation, animation, icon, and validation views, while shared localized text and packaged-resource lookup support the desktop shell.
- `ui/main_window.py`
- `ui/create_editor.py`
- `ui/i18n.py`
- `ui/resources.py`

#### Animation authoring pipeline
Animation state—frames and playback/export metadata such as FPS, duration, levels, butthurt ranges, and weight—is managed separately from UI rendering. The timeline provides frame ordering and interactive controls; imported files can enter through drag-and-drop. This stage produces the model consumed by preview and export.
- `core/animation_manager.py`
- `ui/animation_timeline.py`
- `ui/drag_drop_widget.py`

#### Image ingestion and normalization
Source PNGs, and editor-assisted GIF/JPG inputs, cross into the core image-processing boundary. Images are resized/centered and converted to Flipper’s 1-bit representation, with Floyd–Steinberg dithering intended to preserve detail. UI crop editors prepare user-selected source regions before this conversion path.
- `core/image_processor.py`
- `ui/gif_crop_editor.py`
- `ui/jpg_crop_editor.py`

#### Flipper binary formats and export
Export converts normalized frames into raw `.bm` or Heatshrink-compressed `.bmx`, writes animation `meta.txt` and `manifest.txt`, and materializes Momentum-compatible `Anims/` and `Icons/Passport/` directory layouts. Icon export has a dedicated builder for supported Passport dimensions and binary metadata. Decoder utilities provide the complementary `.bm`/`.bmx` interpretation boundary.
- `core/exporter.py`
- `core/icon_builder.py`
- `core/bm_bmx_decoder.py`

#### Validation boundary
Pack validation is independent of editing/export and checks exported or external asset-pack structure, metadata, frame sizing, and sequence consistency. Its results are presented through a dedicated UI widget, making validation usable before deployment to device storage.
- `core/validator.py`
- `ui/validator_widget.py`

#### Runtime, packaging, and delivery
The application targets Python 3.10+, with PyQt6, Pillow/NumPy for image work, and `heatshrink2` for BMX compression. PyInstaller packages a one-file/windowed executable with bundled assets; platform build scripts wrap the spec. GitHub Actions publishes tagged release builds for Windows, macOS arm64, and Linux. No server, database, or network service is part of the operational architecture.
- `FlipperAssetStudio.spec`
- `scripts/build.sh`
- `scripts/build_windows.bat`
- `.github/workflows/release.yml`

Main entry points: [`ui/main_window.py`](https://github.com/d13young/flipper-asset-studio/blob/main/ui/main_window.py) (Main window), [`core/animation_manager.py`](https://github.com/d13young/flipper-asset-studio/blob/main/core/animation_manager.py) (Animation model), [`core/image_processor.py`](https://github.com/d13young/flipper-asset-studio/blob/main/core/image_processor.py) (Image normalization), [`core/exporter.py`](https://github.com/d13young/flipper-asset-studio/blob/main/core/exporter.py) (Animation exporter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop application"]
  node_entry(("Application entry<br/>Python entry point<br/>[main.py]"))
  node_main_window["Main window<br/>PyQt6 shell<br/>[main_window.py]"]
  node_ui_support["UI resources and i18n<br/>desktop support<br/>[i18n.py]"]
  node_create_editor["Creation editor<br/>editor view<br/>[create_editor.py]"]
end

subgraph group_authoring["Authoring pipeline"]
  node_animation_manager["Animation model<br/>state manager"]
  node_timeline["Animation timeline<br/>editor view"]
  node_drag_drop["Drag-and-drop import<br/>input widget"]
  node_crop_editors["GIF/JPG crop editors<br/>image input views<br/>[gif_crop_editor.py]"]
  node_image_processor["Image normalization<br/>image processing<br/>[image_processor.py]"]
  node_preview["Preview rendering<br/>GUI preview"]
end

subgraph group_formats["Export and validation"]
  node_exporter["Animation exporter<br/>pack writer<br/>[exporter.py]"]
  node_icon_builder["Passport icon builder<br/>icon exporter<br/>[icon_builder.py]"]
  node_decoder["BM/BMX decoder<br/>format reader<br/>[bm_bmx_decoder.py]"]
  node_validator["Pack validator<br/>validation engine<br/>[validator.py]"]
  node_validator_ui["Validation results<br/>GUI view"]
  node_asset_packer["Script packer<br/>CLI packer<br/>[asset_packer.py]"]
end

subgraph group_delivery["Build and release"]
  node_packaging["PyInstaller packaging<br/>desktop packaging"]
  node_build_scripts["Platform build scripts<br/>build wrappers<br/>[build.sh]"]
  node_release_ci["Release workflow<br/>GitHub Actions<br/>[release.yml]"]
end

node_entry -->|"starts"| node_main_window
node_main_window -->|"uses"| node_ui_support
node_main_window -->|"hosts"| node_create_editor
node_main_window -->|"hosts"| node_timeline
node_main_window -->|"hosts"| node_validator_ui
node_drag_drop -->|"imports images"| node_image_processor
node_crop_editors -->|"prepares regions"| node_image_processor
node_image_processor -->|"creates normalized frames"| node_animation_manager
node_timeline -->|"edits ordering"| node_animation_manager
node_animation_manager -->|"drives"| node_preview
node_animation_manager -->|"exports frames and metadata"| node_exporter
node_image_processor -->|"supplies 1-bit images"| node_icon_builder
node_exporter -->|"writes BM/BMX"| node_decoder
node_decoder -->|"reads exported frames"| node_validator
node_validator -->|"reports results"| node_validator_ui
node_asset_packer -->|"scripted packing"| node_exporter
node_build_scripts -->|"invokes"| node_packaging
node_release_ci -->|"runs platform builds"| node_build_scripts

click node_entry "https://github.com/d13young/flipper-asset-studio/blob/main/main.py"
click node_main_window "https://github.com/d13young/flipper-asset-studio/blob/main/ui/main_window.py"
click node_ui_support "https://github.com/d13young/flipper-asset-studio/blob/main/ui/i18n.py"
click node_create_editor "https://github.com/d13young/flipper-asset-studio/blob/main/ui/create_editor.py"
click node_animation_manager "https://github.com/d13young/flipper-asset-studio/blob/main/core/animation_manager.py"
click node_timeline "https://github.com/d13young/flipper-asset-studio/blob/main/ui/animation_timeline.py"
click node_drag_drop "https://github.com/d13young/flipper-asset-studio/blob/main/ui/drag_drop_widget.py"
click node_crop_editors "https://github.com/d13young/flipper-asset-studio/blob/main/ui/gif_crop_editor.py"
click node_image_processor "https://github.com/d13young/flipper-asset-studio/blob/main/core/image_processor.py"
click node_exporter "https://github.com/d13young/flipper-asset-studio/blob/main/core/exporter.py"
click node_icon_builder "https://github.com/d13young/flipper-asset-studio/blob/main/core/icon_builder.py"
click node_decoder "https://github.com/d13young/flipper-asset-studio/blob/main/core/bm_bmx_decoder.py"
click node_validator "https://github.com/d13young/flipper-asset-studio/blob/main/core/validator.py"
click node_validator_ui "https://github.com/d13young/flipper-asset-studio/blob/main/ui/validator_widget.py"
click node_asset_packer "https://github.com/d13young/flipper-asset-studio/blob/main/scripts/asset_packer.py"
click node_packaging "https://github.com/d13young/flipper-asset-studio/blob/main/FlipperAssetStudio.spec"
click node_build_scripts "https://github.com/d13young/flipper-asset-studio/blob/main/scripts/build.sh"
click node_release_ci "https://github.com/d13young/flipper-asset-studio/blob/main/.github/workflows/release.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_main_window,node_ui_support,node_create_editor toneBlue
class node_animation_manager,node_timeline,node_drag_drop,node_crop_editors,node_image_processor,node_preview toneAmber
class node_exporter,node_icon_builder,node_decoder,node_validator,node_validator_ui,node_asset_packer toneMint
class node_packaging,node_build_scripts,node_release_ci toneRose
```

## Components

### Desktop application

- [Application entry](https://github.com/d13young/flipper-asset-studio/blob/main/main.py): Python entry point · `main.py`
- [Main window](https://github.com/d13young/flipper-asset-studio/blob/main/ui/main_window.py): PyQt6 shell · Composes creation, animation, icon, and validation workflows. · `ui/main_window.py`
- [UI resources and i18n](https://github.com/d13young/flipper-asset-studio/blob/main/ui/i18n.py): desktop support · `ui/i18n.py`
- [Creation editor](https://github.com/d13young/flipper-asset-studio/blob/main/ui/create_editor.py): editor view · `ui/create_editor.py`

### Authoring pipeline

- [Animation model](https://github.com/d13young/flipper-asset-studio/blob/main/core/animation_manager.py): state manager · Owns frames and playback/export metadata. · `core/animation_manager.py`
- [Animation timeline](https://github.com/d13young/flipper-asset-studio/blob/main/ui/animation_timeline.py): editor view · `ui/animation_timeline.py`
- [Drag-and-drop import](https://github.com/d13young/flipper-asset-studio/blob/main/ui/drag_drop_widget.py): input widget · `ui/drag_drop_widget.py`
- [GIF/JPG crop editors](https://github.com/d13young/flipper-asset-studio/blob/main/ui/gif_crop_editor.py): image input views · Prepare selected source regions before normalization. · `ui/gif_crop_editor.py`
- [Image normalization](https://github.com/d13young/flipper-asset-studio/blob/main/core/image_processor.py): image processing · Resizes, centers, dithers, and converts images to 1-bit frames. · `core/image_processor.py`
- **Preview rendering**: GUI preview

### Export and validation

- [Animation exporter](https://github.com/d13young/flipper-asset-studio/blob/main/core/exporter.py): pack writer · Writes frame binaries, metadata, and Momentum animation layouts. · `core/exporter.py`
- [Passport icon builder](https://github.com/d13young/flipper-asset-studio/blob/main/core/icon_builder.py): icon exporter · Builds supported icon binaries and metadata. · `core/icon_builder.py`
- [BM/BMX decoder](https://github.com/d13young/flipper-asset-studio/blob/main/core/bm_bmx_decoder.py): format reader · Interprets raw and Heatshrink-compressed frame files. · `core/bm_bmx_decoder.py`
- [Pack validator](https://github.com/d13young/flipper-asset-studio/blob/main/core/validator.py): validation engine · Checks layout, metadata, sizing, and frame sequences. · `core/validator.py`
- [Validation results](https://github.com/d13young/flipper-asset-studio/blob/main/ui/validator_widget.py): GUI view · `ui/validator_widget.py`
- [Script packer](https://github.com/d13young/flipper-asset-studio/blob/main/scripts/asset_packer.py): CLI packer · `scripts/asset_packer.py`

### Build and release

- [PyInstaller packaging](https://github.com/d13young/flipper-asset-studio/blob/main/FlipperAssetStudio.spec): desktop packaging · Builds a bundled one-file/windowed executable. · `FlipperAssetStudio.spec`
- [Platform build scripts](https://github.com/d13young/flipper-asset-studio/blob/main/scripts/build.sh): build wrappers · `scripts/build.sh`
- [Release workflow](https://github.com/d13young/flipper-asset-studio/blob/main/.github/workflows/release.yml): GitHub Actions · Publishes tagged Windows, macOS arm64, and Linux builds. · `.github/workflows/release.yml`

## Connections

- Application entry → Main window: starts
- Main window → UI resources and i18n: uses
- Main window → Creation editor: hosts
- Main window → Animation timeline: hosts
- Main window → Validation results: hosts
- Drag-and-drop import → Image normalization: imports images
- GIF/JPG crop editors → Image normalization: prepares regions
- Image normalization → Animation model: creates normalized frames
- Animation timeline → Animation model: edits ordering
- Animation model → Preview rendering: drives
- Animation model → Animation exporter: exports frames and metadata
- Image normalization → Passport icon builder: supplies 1-bit images
- Animation exporter → BM/BMX decoder: writes BM/BMX
- BM/BMX decoder → Pack validator: reads exported frames
- Pack validator → Validation results: reports results
- Script packer → Animation exporter: scripted packing
- Platform build scripts → PyInstaller packaging: invokes
- Release workflow → Platform build scripts: runs platform builds
