Open Houston256 opened 1 month ago
Can't reproduce with:
# Python 3.10.11
trimesh==4.5.1
pillow==10.4.0
numpy==1.26.4
Using (screenshots bad, text good):
import trimesh
import numpy as np
import io
from PIL import Image
mesh = trimesh.creation.cone(radius=1, height=1)
scene = trimesh.Scene([mesh])
scene.set_camera(resolution=(100, 100))
image_data = scene.save_image(background=[1, 2, 3, 4])
with open('scene.png', 'wb') as f:
f.write(image_data)
image = Image.open(io.BytesIO(image_data))
image = np.array(image)
print(np.unique(image[..., 3]))
I get [ 4 67 129 192 255]
, and confirmed that "scene.png" has a transparent background, in an image editor.
Issue description:
The alpha channel is always set to 255, even if I specify backround to be [... , 4].
Minimal reproducible example:
System:
I'm running this on WSL2 / Ubuntu 22.04.5 LTS. Python version 3.10.12
requirements.txt:
My setup: