File size: 4,259 Bytes
a19b884
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1988036
a19b884
 
 
 
 
 
1988036
 
 
a19b884
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1988036
 
 
 
a19b884
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a5c442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
title: Brand Asset Management Tools
emoji: πŸ”§
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: 1.32.2
app_file: app.py
pinned: false
license: mit
python_version: 3.12
---

# πŸ”§ Brand Asset Management Tools

A comprehensive suite of tools for managing and processing brand assets, built with Streamlit.

## Features

This application provides 8 tools for brand asset management:

1. **Extract Images from Excel** - Extract embedded images from Excel worksheets (.xlsx files)
2. **Name Assets by Brand** - Rename files based on brand naming conventions
3. **Canvas White to Transparent** - Convert white backgrounds to transparent in images
4. **Asset Overview** - Generate PDF overview of your assets
5. **Name Stims by Block** - Organize and rename stimulus files by block with output file creation
6. **Re-run Matrix** - Re-process updated zip files and regenerate reports
7. **Resize** - Resize images while maintaining aspect ratio on transparent canvas
8. **Place on Canvas** - Center images on a custom canvas size

## Usage

Simply select the tool you need from the tabs at the top of the application and follow the instructions for each tool.

### Extract Images from Excel
- Upload one or more Excel files (.xlsx)
- Select specific worksheets or all worksheets
- Download extracted images as a ZIP file

### Name Assets by Brand
- Upload images and specify brand naming patterns
- Batch rename files according to your conventions

### Canvas White to Transparent
- Convert white backgrounds in images to transparent
- Useful for logo and asset preparation

### Asset Overview
- Generate comprehensive PDF reports of your asset collections

### Name Stims by Block
- Organize stimulus files by experimental blocks
- Create structured output files

### Re-run Matrix
- Upload a modified zip from "Name Stims by Block"
- Re-analyze files and regenerate PDF/Excel reports

### Resize
- Resize images to specific dimensions
- Maintain transparent backgrounds

### Place on Canvas
- Center images on custom canvas sizes
- Perfect for creating consistent asset formats

## Requirements

- Python 3.12
- Streamlit 1.32.2
- OpenCV (headless)
- Pillow
- ReportLab
- Pandas
- openpyxl
- xlrd

See [requirements.txt](requirements.txt) for complete dependencies.

## Local Development

To run this application locally:

```bash
pip install -r requirements.txt
streamlit run app.py
```

## Verification

Before pushing changes, run the structural validator:

```bash
python scripts/repo_validate.py
```

It performs a `py_compile` sweep over every tracked `*.py`, verifies `requirements.txt` is parseable, and checks the README HF Spaces frontmatter. The same script runs on every PR via `.github/workflows/repo_validate.yml`. Ruff lint over changed Python runs separately via `.github/workflows/gate.yml`.

## Branch & Deploy

`main` is the development base AND the production deploy branch β€” every push to `main` triggers `.github/workflows/main.yml`, which redeploys the Hugging Face Space at `https://huggingface.co/spaces/DecodeMarketing/decode_tools`. There is no staging step.

For the full rules β€” what is "deploy-affecting", the post-merge continuity check, branch naming, PR template β€” see:

- [`docs/guides/protected-boundary-policy.md`](docs/guides/protected-boundary-policy.md) β€” what `main` protects and how to touch it safely
- [`docs/guides/git-and-pr-rules.md`](docs/guides/git-and-pr-rules.md) β€” branch model, observed branches, PR target
- [`docs/guides/review-workflow.md`](docs/guides/review-workflow.md) β€” reviewer subagent contract
- [`.github/pull_request_template.md`](.github/pull_request_template.md) β€” PR checklist

## Architecture

`app.py` wires 8 tabs (`tab1.py`–`tab8.py`) into a single Streamlit page; all tabs share utilities from `helper.py`. For the topology map and the helper consumer table, see:

- [`docs/architecture/repository-erd.md`](docs/architecture/repository-erd.md) β€” runtime topology, file map, deploy pipe
- [`docs/architecture/active-surface.md`](docs/architecture/active-surface.md) β€” `helper.py` exports and which tab consumes what

For the full doc tree: [`docs/INDEX.md`](docs/INDEX.md). For AI-contributor context: [`AGENTS.md`](AGENTS.md) and [`CLAUDE.md`](CLAUDE.md).