mirror of
https://github.com/BinomialLLC/basis_universal.git
synced 2026-06-12 10:33:51 +00:00
adding new files
This commit is contained in:
19
python/tests/test_basic_decode.py
Normal file
19
python/tests/test_basic_decode.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from basisu_py import Transcoder
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
|
||||
# Load input file
|
||||
with open("test.ktx2", "rb") as f:
|
||||
data = f.read()
|
||||
|
||||
# Decode (AUTO backend)
|
||||
t = Transcoder()
|
||||
rgba = t.decode_rgba(data) # returns HxWx4 uint8 NumPy array
|
||||
|
||||
print("Decoded:", rgba.shape, rgba.dtype)
|
||||
|
||||
# Convert to Pillow Image and save
|
||||
img = Image.fromarray(rgba, mode="RGBA")
|
||||
img.save("decoded.png")
|
||||
|
||||
print("Wrote decoded.png")
|
||||
Reference in New Issue
Block a user