image-analyser 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- image_analyser-0.1.0/.gitignore +26 -0
- image_analyser-0.1.0/LICENSE +21 -0
- image_analyser-0.1.0/PKG-INFO +198 -0
- image_analyser-0.1.0/README.md +137 -0
- image_analyser-0.1.0/docs/superpowers/plans/2026-05-09-image-analyser-v0.1.0.md +3211 -0
- image_analyser-0.1.0/docs/superpowers/specs/2026-05-08-image-analyser-design.md +313 -0
- image_analyser-0.1.0/pyproject.toml +82 -0
- image_analyser-0.1.0/src/image_analyser/__init__.py +10 -0
- image_analyser-0.1.0/src/image_analyser/__main__.py +6 -0
- image_analyser-0.1.0/src/image_analyser/app.py +120 -0
- image_analyser-0.1.0/src/image_analyser/barcode.py +27 -0
- image_analyser-0.1.0/src/image_analyser/caption.py +155 -0
- image_analyser-0.1.0/src/image_analyser/cli.py +84 -0
- image_analyser-0.1.0/src/image_analyser/colour.py +56 -0
- image_analyser-0.1.0/src/image_analyser/exceptions.py +13 -0
- image_analyser-0.1.0/src/image_analyser/hashing.py +18 -0
- image_analyser-0.1.0/src/image_analyser/image_analyser.py +222 -0
- image_analyser-0.1.0/src/image_analyser/metadata.py +211 -0
- image_analyser-0.1.0/src/image_analyser/objects.py +73 -0
- image_analyser-0.1.0/src/image_analyser/ocr.py +93 -0
- image_analyser-0.1.0/src/image_analyser/quality.py +112 -0
- image_analyser-0.1.0/src/image_analyser/schemas.py +156 -0
- image_analyser-0.1.0/tests/__init__.py +0 -0
- image_analyser-0.1.0/tests/conftest.py +29 -0
- image_analyser-0.1.0/tests/fixtures/1x1.png +0 -0
- image_analyser-0.1.0/tests/fixtures/animated.gif +0 -0
- image_analyser-0.1.0/tests/fixtures/make_fixtures.py +75 -0
- image_analyser-0.1.0/tests/fixtures/qr.png +0 -0
- image_analyser-0.1.0/tests/fixtures/small.jpg +0 -0
- image_analyser-0.1.0/tests/fixtures/text.png +0 -0
- image_analyser-0.1.0/tests/test_analyser.py +66 -0
- image_analyser-0.1.0/tests/test_app.py +61 -0
- image_analyser-0.1.0/tests/test_barcode.py +21 -0
- image_analyser-0.1.0/tests/test_caption.py +70 -0
- image_analyser-0.1.0/tests/test_cli.py +43 -0
- image_analyser-0.1.0/tests/test_colour.py +28 -0
- image_analyser-0.1.0/tests/test_hashing.py +35 -0
- image_analyser-0.1.0/tests/test_invariants.py +65 -0
- image_analyser-0.1.0/tests/test_metadata.py +61 -0
- image_analyser-0.1.0/tests/test_objects.py +41 -0
- image_analyser-0.1.0/tests/test_ocr.py +54 -0
- image_analyser-0.1.0/tests/test_quality.py +39 -0
- image_analyser-0.1.0/tests/test_schemas.py +52 -0
- image_analyser-0.1.0/uv.lock +3589 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.coverage
|
|
9
|
+
.coverage.*
|
|
10
|
+
htmlcov/
|
|
11
|
+
.pytest_cache/
|
|
12
|
+
.mypy_cache/
|
|
13
|
+
.ruff_cache/
|
|
14
|
+
|
|
15
|
+
# Environments
|
|
16
|
+
.venv/
|
|
17
|
+
venv/
|
|
18
|
+
.env
|
|
19
|
+
|
|
20
|
+
# IDE
|
|
21
|
+
.idea/
|
|
22
|
+
.vscode/
|
|
23
|
+
*.swp
|
|
24
|
+
|
|
25
|
+
# OS
|
|
26
|
+
.DS_Store
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 michael-borck
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: image-analyser
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Static image analysis (CLI + FastAPI) for the analyser family
|
|
5
|
+
Project-URL: Homepage, https://github.com/michael-borck/image-analyser
|
|
6
|
+
Project-URL: Issues, https://github.com/michael-borck/image-analyser/issues
|
|
7
|
+
Author-email: Michael Borck <michael.borck@curtin.edu.au>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: analysis,captioning,exif,image,object-detection,ocr
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: c2pa-python>=0.5
|
|
20
|
+
Requires-Dist: fastapi>=0.115
|
|
21
|
+
Requires-Dist: imagehash>=4.3
|
|
22
|
+
Requires-Dist: numpy>=1.26
|
|
23
|
+
Requires-Dist: pillow-heif>=0.16
|
|
24
|
+
Requires-Dist: pillow>=10
|
|
25
|
+
Requires-Dist: pydantic>=2.6
|
|
26
|
+
Requires-Dist: python-magic>=0.4.27
|
|
27
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
28
|
+
Requires-Dist: pyzbar>=0.1.9
|
|
29
|
+
Requires-Dist: slowapi>=0.1.9
|
|
30
|
+
Requires-Dist: typer>=0.12
|
|
31
|
+
Requires-Dist: uvicorn[standard]>=0.30
|
|
32
|
+
Provides-Extra: all
|
|
33
|
+
Requires-Dist: accelerate>=0.30; extra == 'all'
|
|
34
|
+
Requires-Dist: anthropic>=0.30; extra == 'all'
|
|
35
|
+
Requires-Dist: easyocr>=1.7; extra == 'all'
|
|
36
|
+
Requires-Dist: google-genai>=0.3; extra == 'all'
|
|
37
|
+
Requires-Dist: openai>=1.30; extra == 'all'
|
|
38
|
+
Requires-Dist: pytesseract>=0.3.10; extra == 'all'
|
|
39
|
+
Requires-Dist: torch>=2.2; extra == 'all'
|
|
40
|
+
Requires-Dist: transformers>=4.40; extra == 'all'
|
|
41
|
+
Provides-Extra: api
|
|
42
|
+
Requires-Dist: anthropic>=0.30; extra == 'api'
|
|
43
|
+
Requires-Dist: google-genai>=0.3; extra == 'api'
|
|
44
|
+
Requires-Dist: openai>=1.30; extra == 'api'
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
47
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
48
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
49
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
50
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
51
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
52
|
+
Requires-Dist: twine>=5; extra == 'dev'
|
|
53
|
+
Provides-Extra: ml
|
|
54
|
+
Requires-Dist: accelerate>=0.30; extra == 'ml'
|
|
55
|
+
Requires-Dist: torch>=2.2; extra == 'ml'
|
|
56
|
+
Requires-Dist: transformers>=4.40; extra == 'ml'
|
|
57
|
+
Provides-Extra: ocr
|
|
58
|
+
Requires-Dist: easyocr>=1.7; extra == 'ocr'
|
|
59
|
+
Requires-Dist: pytesseract>=0.3.10; extra == 'ocr'
|
|
60
|
+
Description-Content-Type: text/markdown
|
|
61
|
+
|
|
62
|
+
# image-analyser
|
|
63
|
+
|
|
64
|
+
[](https://pypi.org/project/image-analyser/)
|
|
65
|
+
[](https://pypi.org/project/image-analyser/)
|
|
66
|
+
[](LICENSE)
|
|
67
|
+
|
|
68
|
+
Static image analysis (CLI + FastAPI) for the analyser family.
|
|
69
|
+
|
|
70
|
+
Given a single image file, image-analyser returns:
|
|
71
|
+
|
|
72
|
+
- **Format** — JPEG / PNG / WebP / AVIF / HEIC / GIF / TIFF / BMP, MIME type, resolution, megapixels, aspect class, colour mode, bit depth, alpha, file size.
|
|
73
|
+
- **Hashes** — SHA-256 of bytes, perceptual pHash and dHash for dedup.
|
|
74
|
+
- **Metadata** — EXIF (camera, lens, ISO, GPS, timestamp), IPTC, XMP, ICC profile, C2PA Content Credentials.
|
|
75
|
+
- **Quality** — blur (Laplacian variance), exposure (under / over / clipping), brightness, contrast, noise, JPEG-quality estimate.
|
|
76
|
+
- **Colour** — k-means dominant palette + average colour.
|
|
77
|
+
- **Barcodes / QR codes** — via pyzbar.
|
|
78
|
+
- **Animation** — frame count + duration for GIF / WebP.
|
|
79
|
+
- **Object detection** *(opt-in `[ml]`)* — DETR by default; configurable HuggingFace pipeline.
|
|
80
|
+
- **Caption / textual description** *(opt-in `[ml]` or `[api]`)* — local BLIP, or one of Anthropic / OpenAI / Google / OpenRouter.
|
|
81
|
+
- **OCR** *(opt-in `[ocr]`)* — Tesseract or EasyOCR.
|
|
82
|
+
|
|
83
|
+
Anything that can't run in the current install lands in `result.skipped[]` with a stable reason. Anything that raises lands in `result.failed[]`. The HTTP response stays 200.
|
|
84
|
+
|
|
85
|
+
## Install
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install image-analyser # Tier 1 only
|
|
89
|
+
pip install image-analyser[ml] # + DETR object detection + local BLIP captioning
|
|
90
|
+
pip install image-analyser[ocr] # + Tesseract / EasyOCR
|
|
91
|
+
pip install image-analyser[api] # + API captioning (no torch needed)
|
|
92
|
+
pip install image-analyser[all] # everything
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
System dependencies:
|
|
96
|
+
|
|
97
|
+
- `libzbar0` (for barcode/QR detection): `brew install zbar` / `apt install libzbar0`
|
|
98
|
+
- `libmagic` (for MIME detection): `brew install libmagic` / `apt install libmagic1`
|
|
99
|
+
- `tesseract` (only if `[ocr]` extra used and tesseract is the engine): `brew install tesseract` / `apt install tesseract-ocr`
|
|
100
|
+
|
|
101
|
+
## CLI
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
image-analyser photo.jpg # pretty JSON
|
|
105
|
+
image-analyser photo.jpg --json # compact JSON
|
|
106
|
+
image-analyser photo.jpg --skip caption,ocr # opt out
|
|
107
|
+
image-analyser photo.jpg --only metadata,quality # opt in
|
|
108
|
+
image-analyser photo.jpg --caption-backend local # force local BLIP
|
|
109
|
+
image-analyser serve # FastAPI on :8006
|
|
110
|
+
image-analyser serve --port 9000
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Legal `--skip` / `--only` values: `metadata`, `quality`, `colour`, `hashing`, `barcode`, `objects`, `caption`, `ocr`.
|
|
114
|
+
|
|
115
|
+
Exit codes: `0` on success (even with `failed[]`), `2` on bad input, `1` on internal error.
|
|
116
|
+
|
|
117
|
+
## HTTP API
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Multipart upload
|
|
121
|
+
curl -F file=@photo.jpg http://127.0.0.1:8006/analyse
|
|
122
|
+
|
|
123
|
+
# JSON with absolute path
|
|
124
|
+
curl -X POST -H "Content-Type: application/json" \
|
|
125
|
+
-d '{"path":"/abs/path/photo.jpg","skip":["caption"]}' \
|
|
126
|
+
http://127.0.0.1:8006/analyse
|
|
127
|
+
|
|
128
|
+
# Health check
|
|
129
|
+
curl http://127.0.0.1:8006/health
|
|
130
|
+
# {"status": "ok", "version": "0.1.0"}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Python library
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from image_analyser import ImageAnalyser
|
|
137
|
+
|
|
138
|
+
result = ImageAnalyser().analyse("photo.jpg")
|
|
139
|
+
print(result.metadata.exif.camera if result.metadata.exif else "no EXIF")
|
|
140
|
+
print(result.quality.blur_score, result.colour.dominant)
|
|
141
|
+
for s in result.skipped:
|
|
142
|
+
print("skipped", s.name, "—", s.reason)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
All env vars use the `IMAGE_ANALYSER_` prefix.
|
|
148
|
+
|
|
149
|
+
| Env var | Default | Purpose |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| `IMAGE_ANALYSER_PORT` | `8006` | FastAPI port |
|
|
152
|
+
| `IMAGE_ANALYSER_HOST` | `127.0.0.1` | bind address |
|
|
153
|
+
| `IMAGE_ANALYSER_MODE` | `production` | `production` / `development` |
|
|
154
|
+
| `IMAGE_ANALYSER_ALLOWED_ORIGINS` | `*` | CORS allow-list (comma-separated) |
|
|
155
|
+
| `IMAGE_ANALYSER_CAPTION_BACKEND` | `auto` | `auto` / `local` / `api` / `none` |
|
|
156
|
+
| `IMAGE_ANALYSER_CAPTION_PROVIDER` | `anthropic` | `anthropic` / `openai` / `google` / `openrouter` |
|
|
157
|
+
| `IMAGE_ANALYSER_CAPTION_MODEL` | provider-default | model id override |
|
|
158
|
+
| `IMAGE_ANALYSER_LOCAL_CAPTION_MODEL` | `Salesforce/blip-image-captioning-base` | HuggingFace BLIP model id |
|
|
159
|
+
| `IMAGE_ANALYSER_OCR_ENGINE` | `auto` | `auto` / `tesseract` / `easyocr` / `none` |
|
|
160
|
+
| `IMAGE_ANALYSER_OBJECT_DETECTION_MODEL` | `facebook/detr-resnet-50` | HuggingFace pipeline model |
|
|
161
|
+
| `IMAGE_ANALYSER_OBJECT_DETECTION_THRESHOLD` | `0.5` | detection-confidence cutoff |
|
|
162
|
+
| `IMAGE_ANALYSER_DEVICE` | `auto` | `auto` / `cpu` / `cuda` / `mps` |
|
|
163
|
+
| `IMAGE_ANALYSER_MAX_UPLOAD_MB` | `50` | reject larger uploads |
|
|
164
|
+
|
|
165
|
+
API keys: standard provider env vars (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY`, `OPENROUTER_API_KEY`).
|
|
166
|
+
|
|
167
|
+
## Development
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
git clone https://github.com/michael-borck/image-analyser
|
|
171
|
+
cd image-analyser
|
|
172
|
+
python -m venv .venv && source .venv/bin/activate
|
|
173
|
+
pip install -e ".[dev,all]"
|
|
174
|
+
python tests/fixtures/make_fixtures.py
|
|
175
|
+
pytest # fast tests
|
|
176
|
+
pytest -m slow # opt-in ML / engine tests
|
|
177
|
+
ruff check .
|
|
178
|
+
mypy src
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## The analyser family
|
|
182
|
+
|
|
183
|
+
| Tool | PyPI | Port | Role |
|
|
184
|
+
|---|---|---|---|
|
|
185
|
+
| auto-analyser | ✓ | — | router (file → specialist) |
|
|
186
|
+
| bundle-analyser | ✓ | 8008 | folder / zip walker |
|
|
187
|
+
| code-analyser | ✓ | 8004 | source code analysis |
|
|
188
|
+
| document-analyser | ✓ | 8000 | document analysis |
|
|
189
|
+
| git-analyser | ✓ | 8007 | git repo analysis |
|
|
190
|
+
| **image-analyser** | ✓ | **8006** | **static image analysis (this repo)** |
|
|
191
|
+
| records-analyser | ✓ | 8003 | structured-records analysis |
|
|
192
|
+
| speech-analyser | ✓ | 8001 | audio transcription / speech analysis |
|
|
193
|
+
| video-analyser | ✓ | 8002 | video analysis |
|
|
194
|
+
| wordpress-analyser | ✓ | 8005 | WordPress export analysis |
|
|
195
|
+
|
|
196
|
+
## Licence
|
|
197
|
+
|
|
198
|
+
MIT © Michael Borck.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# image-analyser
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/image-analyser/)
|
|
4
|
+
[](https://pypi.org/project/image-analyser/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
Static image analysis (CLI + FastAPI) for the analyser family.
|
|
8
|
+
|
|
9
|
+
Given a single image file, image-analyser returns:
|
|
10
|
+
|
|
11
|
+
- **Format** — JPEG / PNG / WebP / AVIF / HEIC / GIF / TIFF / BMP, MIME type, resolution, megapixels, aspect class, colour mode, bit depth, alpha, file size.
|
|
12
|
+
- **Hashes** — SHA-256 of bytes, perceptual pHash and dHash for dedup.
|
|
13
|
+
- **Metadata** — EXIF (camera, lens, ISO, GPS, timestamp), IPTC, XMP, ICC profile, C2PA Content Credentials.
|
|
14
|
+
- **Quality** — blur (Laplacian variance), exposure (under / over / clipping), brightness, contrast, noise, JPEG-quality estimate.
|
|
15
|
+
- **Colour** — k-means dominant palette + average colour.
|
|
16
|
+
- **Barcodes / QR codes** — via pyzbar.
|
|
17
|
+
- **Animation** — frame count + duration for GIF / WebP.
|
|
18
|
+
- **Object detection** *(opt-in `[ml]`)* — DETR by default; configurable HuggingFace pipeline.
|
|
19
|
+
- **Caption / textual description** *(opt-in `[ml]` or `[api]`)* — local BLIP, or one of Anthropic / OpenAI / Google / OpenRouter.
|
|
20
|
+
- **OCR** *(opt-in `[ocr]`)* — Tesseract or EasyOCR.
|
|
21
|
+
|
|
22
|
+
Anything that can't run in the current install lands in `result.skipped[]` with a stable reason. Anything that raises lands in `result.failed[]`. The HTTP response stays 200.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install image-analyser # Tier 1 only
|
|
28
|
+
pip install image-analyser[ml] # + DETR object detection + local BLIP captioning
|
|
29
|
+
pip install image-analyser[ocr] # + Tesseract / EasyOCR
|
|
30
|
+
pip install image-analyser[api] # + API captioning (no torch needed)
|
|
31
|
+
pip install image-analyser[all] # everything
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
System dependencies:
|
|
35
|
+
|
|
36
|
+
- `libzbar0` (for barcode/QR detection): `brew install zbar` / `apt install libzbar0`
|
|
37
|
+
- `libmagic` (for MIME detection): `brew install libmagic` / `apt install libmagic1`
|
|
38
|
+
- `tesseract` (only if `[ocr]` extra used and tesseract is the engine): `brew install tesseract` / `apt install tesseract-ocr`
|
|
39
|
+
|
|
40
|
+
## CLI
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
image-analyser photo.jpg # pretty JSON
|
|
44
|
+
image-analyser photo.jpg --json # compact JSON
|
|
45
|
+
image-analyser photo.jpg --skip caption,ocr # opt out
|
|
46
|
+
image-analyser photo.jpg --only metadata,quality # opt in
|
|
47
|
+
image-analyser photo.jpg --caption-backend local # force local BLIP
|
|
48
|
+
image-analyser serve # FastAPI on :8006
|
|
49
|
+
image-analyser serve --port 9000
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Legal `--skip` / `--only` values: `metadata`, `quality`, `colour`, `hashing`, `barcode`, `objects`, `caption`, `ocr`.
|
|
53
|
+
|
|
54
|
+
Exit codes: `0` on success (even with `failed[]`), `2` on bad input, `1` on internal error.
|
|
55
|
+
|
|
56
|
+
## HTTP API
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Multipart upload
|
|
60
|
+
curl -F file=@photo.jpg http://127.0.0.1:8006/analyse
|
|
61
|
+
|
|
62
|
+
# JSON with absolute path
|
|
63
|
+
curl -X POST -H "Content-Type: application/json" \
|
|
64
|
+
-d '{"path":"/abs/path/photo.jpg","skip":["caption"]}' \
|
|
65
|
+
http://127.0.0.1:8006/analyse
|
|
66
|
+
|
|
67
|
+
# Health check
|
|
68
|
+
curl http://127.0.0.1:8006/health
|
|
69
|
+
# {"status": "ok", "version": "0.1.0"}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Python library
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from image_analyser import ImageAnalyser
|
|
76
|
+
|
|
77
|
+
result = ImageAnalyser().analyse("photo.jpg")
|
|
78
|
+
print(result.metadata.exif.camera if result.metadata.exif else "no EXIF")
|
|
79
|
+
print(result.quality.blur_score, result.colour.dominant)
|
|
80
|
+
for s in result.skipped:
|
|
81
|
+
print("skipped", s.name, "—", s.reason)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
All env vars use the `IMAGE_ANALYSER_` prefix.
|
|
87
|
+
|
|
88
|
+
| Env var | Default | Purpose |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| `IMAGE_ANALYSER_PORT` | `8006` | FastAPI port |
|
|
91
|
+
| `IMAGE_ANALYSER_HOST` | `127.0.0.1` | bind address |
|
|
92
|
+
| `IMAGE_ANALYSER_MODE` | `production` | `production` / `development` |
|
|
93
|
+
| `IMAGE_ANALYSER_ALLOWED_ORIGINS` | `*` | CORS allow-list (comma-separated) |
|
|
94
|
+
| `IMAGE_ANALYSER_CAPTION_BACKEND` | `auto` | `auto` / `local` / `api` / `none` |
|
|
95
|
+
| `IMAGE_ANALYSER_CAPTION_PROVIDER` | `anthropic` | `anthropic` / `openai` / `google` / `openrouter` |
|
|
96
|
+
| `IMAGE_ANALYSER_CAPTION_MODEL` | provider-default | model id override |
|
|
97
|
+
| `IMAGE_ANALYSER_LOCAL_CAPTION_MODEL` | `Salesforce/blip-image-captioning-base` | HuggingFace BLIP model id |
|
|
98
|
+
| `IMAGE_ANALYSER_OCR_ENGINE` | `auto` | `auto` / `tesseract` / `easyocr` / `none` |
|
|
99
|
+
| `IMAGE_ANALYSER_OBJECT_DETECTION_MODEL` | `facebook/detr-resnet-50` | HuggingFace pipeline model |
|
|
100
|
+
| `IMAGE_ANALYSER_OBJECT_DETECTION_THRESHOLD` | `0.5` | detection-confidence cutoff |
|
|
101
|
+
| `IMAGE_ANALYSER_DEVICE` | `auto` | `auto` / `cpu` / `cuda` / `mps` |
|
|
102
|
+
| `IMAGE_ANALYSER_MAX_UPLOAD_MB` | `50` | reject larger uploads |
|
|
103
|
+
|
|
104
|
+
API keys: standard provider env vars (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY`, `OPENROUTER_API_KEY`).
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
git clone https://github.com/michael-borck/image-analyser
|
|
110
|
+
cd image-analyser
|
|
111
|
+
python -m venv .venv && source .venv/bin/activate
|
|
112
|
+
pip install -e ".[dev,all]"
|
|
113
|
+
python tests/fixtures/make_fixtures.py
|
|
114
|
+
pytest # fast tests
|
|
115
|
+
pytest -m slow # opt-in ML / engine tests
|
|
116
|
+
ruff check .
|
|
117
|
+
mypy src
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## The analyser family
|
|
121
|
+
|
|
122
|
+
| Tool | PyPI | Port | Role |
|
|
123
|
+
|---|---|---|---|
|
|
124
|
+
| auto-analyser | ✓ | — | router (file → specialist) |
|
|
125
|
+
| bundle-analyser | ✓ | 8008 | folder / zip walker |
|
|
126
|
+
| code-analyser | ✓ | 8004 | source code analysis |
|
|
127
|
+
| document-analyser | ✓ | 8000 | document analysis |
|
|
128
|
+
| git-analyser | ✓ | 8007 | git repo analysis |
|
|
129
|
+
| **image-analyser** | ✓ | **8006** | **static image analysis (this repo)** |
|
|
130
|
+
| records-analyser | ✓ | 8003 | structured-records analysis |
|
|
131
|
+
| speech-analyser | ✓ | 8001 | audio transcription / speech analysis |
|
|
132
|
+
| video-analyser | ✓ | 8002 | video analysis |
|
|
133
|
+
| wordpress-analyser | ✓ | 8005 | WordPress export analysis |
|
|
134
|
+
|
|
135
|
+
## Licence
|
|
136
|
+
|
|
137
|
+
MIT © Michael Borck.
|