Skip to main content

gltf_draco_transcoder

A high-performance Python package for compressing and decompressing glb files using the Draco 3D data compression library. This package provides both a Python API and a command-line interface for efficient 3D model compression.

Features

  • Compression: Compress glb files using Draco compression to reduce file sizes significantly
  • Decompression: Decompress Draco-compressed glb files back to standard glTF format
  • High Performance: C++ backend with Python bindings for maximum performance
  • Cross-platform: Supports Windows, macOS (ARM64), and Linux (x86_64 and ARM64)
  • Configurable: Fine-tune compression quality with quantization and compression level settings
  • Easy Integration: Simple Python API and command-line interface

Live Demo

Try the online demo to see Draco compression in action on glTF files. The demo uses the WebAssembly (WASM) port of the same C++ codebase as this Python package.

Installation

Install from PyPI:

pip install gltf_draco_transcoder

Usage

Python API

Basic Compression

from gltf_draco_transcoder import compress_gltf, decompress_gltf

# Compress a glb file
compressed_data = compress_gltf('input.glb')

# Save compressed data
with open('output_compressed.glb', 'wb') as f:
    f.write(compressed_data.getvalue())

# Decompress back to glb
decompressed_data = decompress_gltf('output_compressed.glb')
with open('output_decompressed.glb', 'wb') as f:
    f.write(decompressed_data.getvalue())

Advanced Compression with Custom Options

from gltf_draco_transcoder import compress_gltf

# Compress with custom quantization and compression level settings
# qp: quantization_position, qn: quantization_normal, cl: compression_level
compressed_data = compress_gltf('input.glb', qp=14, qn=10, cl=9)

Command Line Interface

Compress a glb file:

python -m gltf_draco_transcoder input.glb output_compressed.glb

This will display compression statistics including file sizes and compression ratio.

Compression Options

The compress_gltf function accepts the following parameters:

  • Quantization Bits (default values shown):

    • qp=11: Position quantization
    • qt=10: Texture coordinate quantization
    • qn=8: Normal vector quantization
    • qc=8: Color quantization
    • qtg=8: Tangent quantization
    • qw=8: Weight quantization
    • qg=8: Generic attribute quantization
  • Compression Level:

    • cl=7: Compression effort (0-10, higher = better compression but slower)

Higher quantization bits = better quality but larger file sizes. Higher compression levels = better compression ratios but slower processing.

Development

Building from Source

This project uses scikit-build-core with CMake and vcpkg for dependency management.

Prerequisites

  • Python 3.10+
  • CMake 3.15+
  • Git
  • vcpkg (automatically installed on Linux via CI scripts)

Build Steps

# Clone the repository
git clone https://github.com/gongfan99/gltf_draco_transcoder.git
cd gltf_draco_transcoder

# Install build dependencies
pip install scikit-build-core setuptools-scm

# Build the package
python -m build

Project Structure

src/gltf_draco_transcoder/
├── __init__.py          # Main API exports
├── loader.py            # Python wrapper and ctypes bindings
├── py.typed             # Type hints marker
└── _version.py          # Version information (auto-generated)

cpp/
├── draco_transcoder_c_api.*    # C API wrapper
└── draco_transcoder_lib.*      # Core C++ implementation

vcpkg-overlays/draco/           # Custom Draco build configuration
vcpkg-triplets/                 # Platform-specific build triplets

Platform Support

  • Linux: x86_64 and ARM64 (manylinux/musllinux wheels)
  • macOS: ARM64
  • Windows: x86_64 (win_amd64 wheels)

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues on GitHub.

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.

Credits

Metadata

Release files for gltf-draco-transcoder 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gltf-draco-transcoder 0.3.1
File Size Uploaded
gltf_draco_transcoder-0.3.1.tar.gz 38.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for gltf-draco-transcoder 0.3.1
File
gltf_draco_transcoder-0.3.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
gltf_draco_transcoder-0.3.1-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
gltf_draco_transcoder-0.3.1-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
gltf_draco_transcoder-0.3.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
gltf_draco_transcoder-0.3.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.27+ ARM64, Linux glibc 2.28+ ARM64 Details
gltf_draco_transcoder-0.3.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 14.9 MB

Release files / gltf_draco_transcoder-0.3.1.tar.gz

Download URL gltf_draco_transcoder-0.3.1.tar.gz
Size 38.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a79a4198d47a191b6d4c27aade33203144b73028d9b92aacf8db639338b2e08a
BLAKE2b-256 checksum
How to use checksums
91d090aa8001fd0cf795aa8c3c1c6b9f08396dea4810318cea831d14e26b38f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Release files / gltf_draco_transcoder-0.3.1-py3-none-win_amd64.whl

Download URL gltf_draco_transcoder-0.3.1-py3-none-win_amd64.whl
Size 474.4 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
ab07cba014304f3399f9f34ffddacd40526b3dec88eec7e722e1874be296b7eb
BLAKE2b-256 checksum
How to use checksums
f313f0ad877046ac26ba48e81592b67dcda0ea43dd363c651cd43c8ea57ed168
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Release files / gltf_draco_transcoder-0.3.1-py3-none-musllinux_1_2_x86_64.whl

Download URL gltf_draco_transcoder-0.3.1-py3-none-musllinux_1_2_x86_64.whl
Size 3.8 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
e6050f711fb18391303a53d2ec1b50e6b92b3d262e2fa1eeb1bc777329f4ec2e
BLAKE2b-256 checksum
How to use checksums
900a9eea6ff899540b5562498a2cc72fded35dd695833104d121894a307c7d7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Release files / gltf_draco_transcoder-0.3.1-py3-none-musllinux_1_2_aarch64.whl

Download URL gltf_draco_transcoder-0.3.1-py3-none-musllinux_1_2_aarch64.whl
Size 3.6 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f382399dac7946b45823d405831a0f99a734f79ebb620c2e33829ba04390287a
BLAKE2b-256 checksum
How to use checksums
4f3dc80e8d4a590090c4d14f1930ef87c12cff0fcc35d90c0532b9276bb01280
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Release files / gltf_draco_transcoder-0.3.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL gltf_draco_transcoder-0.3.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.7 MB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
729cd97b570b81c97cae47c6602ff28ea32bb95f70cf9b9c94ecb9f00bbab4b4
BLAKE2b-256 checksum
How to use checksums
6db621ceb76908bc34949676db03b5aa04b23a427680089b20529e44b10bca85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Release files / gltf_draco_transcoder-0.3.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL gltf_draco_transcoder-0.3.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 2.5 MB
Tags Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
21d2b06099caf542ac0e1fb5ca3faf7a09e35a3dbe63c5f06a85cd06ba1fe3e1
BLAKE2b-256 checksum
How to use checksums
4157396b30e1bc03e0f7856763d16888ee0a43e20e0f26d0dd546bda13a7243d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Release files / gltf_draco_transcoder-0.3.1-py3-none-macosx_11_0_arm64.whl

Download URL gltf_draco_transcoder-0.3.1-py3-none-macosx_11_0_arm64.whl
Size 1.7 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
364e318fb9ccd90341bd1069bd37a065b512fdf286cc99e4ab9c266756b049ee
BLAKE2b-256 checksum
How to use checksums
f3bfd310de927d7275c9c6b736fd5e0372c999741c58e70d84563b38be1c167b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

7 release files

0.3.0

7 release files

0.2.9

7 release files

0.2.8

7 release files

0.2.7

7 release files

0.2.6

7 release files

0.2.4

7 release files

0.2.3

7 release files

0.0.0

7 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page