Registry / devops / astc-encoder-py

astc-encoder-py

JSON →
library0.1.12pypypi✓ verified 80d ago

Python wrapper for the ASTC texture compression encoder. Current version 0.1.12, released as a PyPI package. Wraps the official astc-encoder library (C++) via ctypes. Used for compressing images to ASTC format, common in GPU texture workflows. Maintained on GitHub.

pip install astc-encoder-py
INSTALL
IMPORT
SIG · ASTC-ENCODER-PY
A
astc-encoder-py
devopspythonv0.1.12
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ASTCConfig
from astc_encoder import ASTCConfig
from astc_encoder import ASTCEncoder
ASTCContext
from astc_encoder import ASTCContext
from astc_encoder import ASTCEncoder
ASTCImage
from astc_encoder import ASTCImage
from astc_encoder import ASTCEncoder

Compress an RGBA image to ASTC format using Pillow for image loading and numpy for pixel data.

from astc_encoder import ASTCEncoder, CompressionMode from PIL import Image import numpy as np encoder = ASTCEncoder() image = Image.open('input.png').convert('RGBA') width, height = image.size pixels = np.array(image, dtype=np.uint8).flatten() compressed = encoder.encode( pixels=pixels, width=width, height=height, channels=4, block_width=4, block_height=4, compression_mode=CompressionMode.MEDIUM, ) with open('output.astc', 'wb') as f: f.write(compressed) print('ASTC compressed data written, size:', len(compressed), 'bytes')
Debug
Known issues
gotchaThe input pixel data must be a flat uint8 array (RGBA order). Using different dtypes or shapes will cause silent errors or crashes.
fix
Ensure pixels = np.asarray(image, dtype=np.uint8).flatten() before passing to encode().
affects: all
breakingIn version 0.1.3, the main class was renamed from 'Encoder' to 'ASTCEncoder'. Old code using 'Encoder' will fail.
fix
Change 'import astc_encoder; encoder = astc_encoder.Encoder()' to 'from astc_encoder import ASTCEncoder; encoder = ASTCEncoder()'.
affects: >=0.1.3
deprecatedThe 'quality' parameter (integer) was replaced with 'compression_mode' (CompressionMode enum) in version 0.1.0. Using 'quality' still works but emits deprecation warning and may be removed.
fix
Use compression_mode=CompressionMode.MEDIUM instead of quality=50.
affects: >=0.1.0
Upgrade
Version history
0.1.12latest on PyPI · released Sep 6, 2025
Audit
Dependencies
Pillowoptionalrequired for loading/saving images (used in quickstart examples)
numpyoptionalused internally, usually installed via Pillow
Agent activity
21 hits · last 30 days
node
20
OpenAI (training)
1
Resources
astc-encoder-py — pip install astc-encoder-py · libregistry