Metadata-Version: 2.4
Name: morphosx
Version: 0.8.14
Summary: high-performance media processing engine for on-the-fly image transformations and storage.
Author: Davide Di Criscito
License: MIT
License-File: LICENSE
Keywords: 3d,bim,cdn,fastapi,ifc,image-processing,media,on-the-fly
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Requires-Python: <3.15,>=3.11
Requires-Dist: aioboto3<16.0.0,>=15.5.0
Requires-Dist: aiofiles<26.0.0,>=25.1.0
Requires-Dist: fastapi<0.133.0,>=0.132.0
Requires-Dist: ffmpeg-python<0.3.0,>=0.2.0
Requires-Dist: markdown<4.0.0,>=3.10.2
Requires-Dist: passlib[bcrypt]<2.0.0,>=1.7.4
Requires-Dist: pillow<13.0.0,>=12.1.1
Requires-Dist: pydantic-settings<3.0.0,>=2.13.1
Requires-Dist: pygments<3.0.0,>=2.19.2
Requires-Dist: python-jose[cryptography]<4.0.0,>=3.5.0
Requires-Dist: python-multipart<0.0.23,>=0.0.22
Requires-Dist: trimesh<5.0.0,>=4.11.2
Requires-Dist: uvicorn<0.42.0,>=0.41.0
Provides-Extra: 3d
Requires-Dist: pygltflib<2.0.0,>=1.16.5; extra == '3d'
Requires-Dist: trimesh<5.0.0,>=4.11.2; extra == '3d'
Provides-Extra: bim
Requires-Dist: ifcopenshell<0.9.0,>=0.8.4.post1; extra == 'bim'
Provides-Extra: full
Requires-Dist: ffmpeg-python; extra == 'full'
Requires-Dist: ifcopenshell; extra == 'full'
Requires-Dist: imageio; extra == 'full'
Requires-Dist: numpy; extra == 'full'
Requires-Dist: openpyxl; extra == 'full'
Requires-Dist: pillow-avif-plugin; extra == 'full'
Requires-Dist: pillow-heif; extra == 'full'
Requires-Dist: pygltflib; extra == 'full'
Requires-Dist: pymupdf; extra == 'full'
Requires-Dist: python-docx; extra == 'full'
Requires-Dist: python-pptx; extra == 'full'
Requires-Dist: pyvips; extra == 'full'
Requires-Dist: rawpy; extra == 'full'
Requires-Dist: trimesh; extra == 'full'
Provides-Extra: modern
Requires-Dist: pillow-avif-plugin<2.0.0,>=1.5.5; extra == 'modern'
Requires-Dist: pillow-heif<2.0.0,>=1.2.1; extra == 'modern'
Provides-Extra: office
Requires-Dist: openpyxl<4.0.0,>=3.1.5; extra == 'office'
Requires-Dist: python-docx<2.0.0,>=1.2.0; extra == 'office'
Requires-Dist: python-pptx<2.0.0,>=1.0.2; extra == 'office'
Provides-Extra: pdf
Requires-Dist: pymupdf<2.0.0,>=1.27.1; extra == 'pdf'
Provides-Extra: raw
Requires-Dist: imageio<3.0.0,>=2.37.2; extra == 'raw'
Requires-Dist: numpy<2.0.0; extra == 'raw'
Requires-Dist: rawpy<0.27.0,>=0.26.1; extra == 'raw'
Provides-Extra: video
Requires-Dist: ffmpeg-python<0.3.0,>=0.2.0; extra == 'video'
Provides-Extra: vips
Requires-Dist: pyvips<4.0.0,>=3.1.1; extra == 'vips'
Description-Content-Type: text/markdown

<p align="center">
  <img src="morphosx-banner.png" alt="morphosx banner" width="600px">
</p>

# morphosx 🧬

> **High performance, low footprint.**  
> Self-hosted, open-source media engine for on-the-fly image processing and delivery.

`morphosx` is a high-speed, minimal cloud storage and media manipulation server. It converts almost any media type into an optimized, web-ready image derivative on-the-fly.

---

## ⚡ Core Features

- **User-Bound Security**: Protected assets and HMAC signatures tied to specific **JWT-authenticated** users.
- **Private Folders**: Secure per-user storage using the `users/{user_id}/` path convention.
- **Universal Rendering**: Support for BIM (IFC), 3D (STL/OBJ/GLB), Office, Font Specimen, Archives, Video, Audio, and RAW.
- **Modern Engines**: Choice between **Pillow** and **PyVips** (ultra-fast).
- **Cloud Ready**: Pluggable storage system (Local & **Amazon S3**).
- **Smart Caching**: Automatic derivative caching for optimized delivery.

---

## 🚀 Installation & Deployment

### 1. Using Docker (Recommended)

The easiest way to run Morphosx with all features and system dependencies pre-installed.

```bash
docker run -p 6100:6100 --env-file .env ghcr.io/dcdavidev/morphosx:latest
```

### 2. Using pip (from PyPI)

You can install Morphosx as a library or a standalone CLI tool.

```bash
# Core installation (standard images only)
pip install morphosx

# Full installation (all media types support)
pip install "morphosx[full]"

# Selective installation
pip install "morphosx[video,pdf,3d]"
```

**Note**: Some extras require system libraries (e.g., `ffmpeg` for video, `libvips` for vips engine).

---

## 📖 Documentation

For detailed guides, check out the `docs/` folder:

- [**Introduction**](docs/introduction.md): Overview, architecture, and quick start.
- [**Upload Guide**](docs/upload.md): Managing public and private asset uploads.
- [**Processing & Presets**](docs/processing.md): On-the-fly transformations and smart presets.
- [**Security & Signatures**](docs/security.md): HMAC validation and asset protection.
- [**Configuration**](docs/configuration.md): Environment variables and server settings.

---

## 🛠️ Usage Guide

### 1. Uploading Assets

**Public Upload**
```bash
curl -X POST "http://localhost:6100/v1/assets/upload?folder=news" -F "file=@img.jpg"
```

**Private Upload**
```bash
curl -X POST "http://localhost:6100/v1/assets/upload?private=true" \
     -H "Authorization: Bearer <TOKEN>" -F "file=@secret.pdf"
```

### 2. Retrieving & Processing

All GET requests must be signed using HMAC-SHA256.

```text
GET /v1/assets/my-image.jpg?width=300&format=webp&signature=HASH
```

---

## ✨ Smart Presets

Use predefined aliases for cleaner URLs:

- `preset=thumb`: 150x150 WebP.
- `preset=hero`: 1920px WebP.
- `preset=social`: 1200x630 JPEG.
- `preset=preview`: 400px PNG.

---

## 🛡️ Advanced Security

Morphosx uses **HMAC-SHA256** to prevent DoS attacks and unauthorized manipulation.
The signature payload includes: `asset_id | width | height | format | quality | preset | user_id`.

---

## 🧪 Supported Media Table

| Category       | Extra      | Extensions          | Output Type            |
| :------------- | :--------- | :------------------ | :--------------------- |
| **BIM**        | `[bim]`    | ifc                 | Technical Project Card |
| **3D**         | `[3d]`     | stl, obj, glb, gltf | Technical Blueprint    |
| **Images**     | Core       | jpg, png, webp      | Processed Image        |
| **Modern Img** | `[modern]` | heic, avif          | Processed Image        |
| **RAW**        | `[raw]`    | cr2, nef, dng, arw  | Developed Image        |
| **Video**      | `[video]`  | mp4, mov, webm, avi | Frame @ timestamp      |
| **Audio**      | `[video]`  | mp3, wav, ogg, flac | Waveform Image         |
| **Docs**       | `[pdf]`    | pdf                 | Page Render            |
| **Office**     | `[office]` | docx, pptx, xlsx    | Summary Card           |
| **Text**       | Core       | json, xml, md, txt  | Syntax-highlighted     |
| **Typography** | Core       | ttf, otf            | Font Specimen          |
| **Archives**   | Core       | zip, tar            | Content List           |

---

## 📜 License

MIT - Built for the Open Source community.

