INNER CODE UNIT · Python

compress_mip_to_astc

untoldengine/UntoldEngine · scripts/texbake.py:298

def compress_mip_to_astc(
    astcenc_bin: str,
    mip_img: "Image.Image",
    block_size: str,
    quality: str,
    srgb: bool,
    tmp_dir: Path,
    label: str,
    extra_args: list[str] | None = None,
) -> bytes:
    """
    Compress a single PIL Image to raw ASTC block bytes.
    Returns only the block payload (strips the 16-byte KHR ASTC container header).

    extra_args: additional astcenc CLI options appended after the required
    profile/input/output/blocksize/quality arguments (e.g. ["-normal", "-perceptual"]
    for normal maps — see astcenc's -normal mode, which re-weights the error metric
    for unit-vector data instead of the default RGB-luminance weighting, and packs

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…