feat: Implement HEIC/HEIF parsing and rebuilding utilities

- Add `heic_types.py` to define structures for HEIC/HEIF boxes including ItemLocationBox, ItemInfoEntryBox, and others.
- Introduce parsing logic in `parser.py` to handle various box types and their contents, including nested structures.
- Implement rebuilding functionality for ItemLocationBox to adjust offsets based on new metadata.
- Enhance ItemInfoBox to correctly parse and build content for ItemInfoEntry.
- Update `pyproject.toml` to include project metadata and dependencies.
This commit is contained in:
Nymiro
2025-10-20 22:19:40 +13:00
parent b3f0fd4ce3
commit 1a40cc236d
28 changed files with 381 additions and 241 deletions
+41
View File
@@ -0,0 +1,41 @@
# pyheic-struct
Utilities for inspecting, modifying, and rebuilding HEIC/HEIF files with a focus on
cross-vendor quirks between Samsung and Apple motion photos.
## Features
- Lightweight parser that exposes core ISOBMFF boxes (`ftyp`, `meta`, `iloc`, `iinf`, etc.)
- Helpers for reconstructing Samsung grid images into flat HEIC pictures
- Rebuilder that writes updated metadata and payload offsets safely
- High-level `convert_samsung_motion_photo` function to create Apple-compatible
HEIC/MOV pairs (with optional MOV ContentIdentifier injection via `exiftool`)
- CLI tool: `pyheic-struct samsung.heic`
## Installation
```bash
pip install .
```
## Usage
```python
from pyheic_struct import convert_samsung_motion_photo
convert_samsung_motion_photo("samsung.heic")
```
Command line:
```bash
pyheic-struct samsung.heic --output-heic samsung_fixed.HEIC
```
## Development
The package targets Python 3.10+. Run the CLI in editable mode:
```bash
python -m pyheic_struct path/to/samsung.heic
```