Metadata-Version: 2.2
Name: aldraco
Version: 0.1.1
Summary: Draco compression/decompression for Python with I3S-friendly attribute decoding.
Requires-Python: >=3.11
Requires-Dist: numpy>=1.23
Description-Content-Type: text/markdown

## aldraco

`aldraco` is a Python library for [Draco](https://github.com/google/draco) mesh/point-cloud compression and decompression, with robust I3S-friendly decoding of custom attributes such as `uv-region` and `feature-index`.

### Install

```bash
pip install aldraco
```

### Decode (one line)

```python
import aldraco

result = aldraco.decode(draco_bytes)
points = result.points
faces = result.faces
uvr = result.uvr           # I3S uv-region, if present
feature_index = result.feature_index  # I3S feature-index, if present
feature_ids = result.feature_ids      # I3S feature-ids from metadata, if present
colors = result.colors     # if present
```

### Decode bytes or .gz bytes (auto-detect)

```python
import aldraco

# If `is_gzip=None`, bytes are treated as gzip when the magic header (1F 8B) is present.
result = aldraco.decode_bytes(maybe_gz_bytes, is_gzip=None)
```

### Normalize to Draco bytes (I/O helpers)

```python
import aldraco

# If input is gzip-wrapped Draco, this returns the raw Draco buffer.
draco_bytes = aldraco.decode_to_bytes(maybe_gz_bytes, is_gzip=None)

# Encode to raw Draco bytes (same as `encode(...)`).
draco_bytes2 = aldraco.encode_to_bytes(points, faces=faces)
```

### Write Draco or .gz Draco to file

```python
import aldraco

aldraco.encode_to_file("out.drc", points, faces=faces)

# If output_path does not end with .gz, `.gz` will be appended automatically.
aldraco.encode_to_gzip_file("out.drc", points, faces=faces)
```

### Decode file (requires output_path)

```python
from pathlib import Path
import aldraco

# Writes the Draco raw bytes (after optional gzip preprocessing) to output_path.
out_draco = Path("out.draco")
result = aldraco.decode_file("demo/datas/IntegratedMeshType/1.bin.gz", out_draco, is_gzip=None)
```

### Gzip helpers (vendored zlib)

```python
from pathlib import Path
import aldraco

gz_bytes = Path("1.bin.gz").read_bytes()

raw = aldraco.gzip_decompress_bytes(gz_bytes, is_gzip=None)
gz2 = aldraco.gzip_compress_bytes(raw, level=6, is_gzip=None)

# File helpers require output_path and overwrite if exists.
aldraco.gzip_decompress_file("1.bin.gz", "1.bin", is_gzip=None)
aldraco.gzip_compress_file("1.bin", "1.bin.gz", level=6, is_gzip=None)
```

