{"id":44852,"library":"etcpak","title":"Etcpak","description":"Python wrapper for the etcpak library, providing fast block-based texture compression (BC1-7, ETC1/2, ASTC) for image data, particularly useful in game development and rendering pipelines. Current version 0.9.15, updated occasionally.","status":"active","version":"0.9.15","language":"python","source_language":"en","source_url":"https://github.com/K0lb3/etcpak","tags":["texture compression","BCn","ETC","ASTC","image processing"],"install":[{"cmd":"pip install etcpak","lang":"bash","label":"PyPI install"}],"dependencies":[],"imports":[{"note":"Direct import of submodule not exposed; use top-level functions after import etcpak","wrong":"import etcpak","symbol":"compress_bc1","correct":"from etcpak import compress_bc1"},{"note":"No common wrong import","symbol":"compress_bc3","correct":"from etcpak import compress_bc3"},{"note":"No common wrong import","symbol":"compress_etc1","correct":"from etcpak import compress_etc1"},{"note":"No common wrong import","symbol":"compress_etc2","correct":"from etcpak import compress_etc2"}],"quickstart":{"code":"from PIL import Image\nimport numpy as np\nfrom etcpak import compress_bc1\n\nimg = Image.open('example.png').convert('RGB')\narr = np.array(img, dtype=np.uint8)\n# Ensure 4x4 aligned (BCn blocks require dimensions multiple of 4)\nheight, width = arr.shape[:2]\nif height % 4 != 0 or width % 4 != 0:\n    raise ValueError('Image dimensions must be multiples of 4 for BCn compression')\ncompressed = compress_bc1(arr.tobytes(), width, height)\nprint(f'Compressed size: {len(compressed)} bytes')","lang":"python","description":"Compress an RGB image to BC1 (DXT1) format. Input data must be 4x4 block-aligned."},"warnings":[{"fix":"Pad image to multiples of 4, or crop. Use e.g., PIL.ImageOps.pad() or np.pad().","message":"Input dimensions must be multiples of 4 for BCn compression (BC1-BC7). Non-aligned sizes cause errors or undefined behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"Convert image to 'RGB' mode (PIL) and use array.tobytes(). For RGBA, use compress_bc3 etc. accordingly.","message":"etcpak expects raw bytes in RGB order (pixel layout). Other orderings (BGRA, RGBA) produce incorrect results. Ensure input is contiguous and correctly ordered.","severity":"gotcha","affected_versions":"all"},{"fix":"Extract the two channels and pack as interleaved bytes (R,G,R,G...).","message":"compress_bc5 expects two-channel input (RG). Providing 4-channel data will cause errors or silent corruption.","severity":"gotcha","affected_versions":"all"},{"fix":"Install `pip install etcpak==0.9.15` and use `from etcpak import ...`.","message":"The 'etcpak' module may be confused with 'pyetcpak' or 'etcpak-compress'. Always use 'etcpak' from PyPI by K0lb3.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"search_vec":"'-7':16 '0.9.15':32 'astc':18,39 'base':12 'bc1':15 'bcn':37 'block':11 'block-bas':10 'compress':14,36 'current':30 'data':21 'develop':26 'etc':38 'etc1/2':17 'etcpak':1,6 'fast':9 'game':25 'imag':20,40 'librari':7 'occasion':34 'particular':22 'pipelin':29 'process':41 'provid':8 'python':2 'render':28 'textur':13,35 'updat':33 'use':23 'version':31 'wrapper':3","created_at":"2026-06-07T12:52:09.202501+00:00","updated_at":"2026-06-07T12:52:09.202501+00:00","problems":[{"fix":"Resize or pad image to multiples of 4 before feeding to etcpak.","cause":"Input image dimensions not divisible by 4 for BCn compression.","error":"ValueError: The height and width must be multiples of 4."},{"fix":"Use `arr.tobytes()` or `arr.tostring()` to convert to bytes.","cause":"Passed a numpy array directly instead of its bytes() representation.","error":"TypeError: a bytes-like object is required, not 'array'"},{"fix":"Install using `pip install etcpak`. Ensure no conflicting packages.","cause":"Package not installed or installed under a different name (e.g., 'pyetcpak').","error":"ModuleNotFoundError: No module named 'etcpak'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/K0lb3/etcpak","github":"https://github.com/K0lb3/etcpak","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}