diff --git a/python/taichi/ui/staging_buffer.py b/python/taichi/ui/staging_buffer.py index f7377c9843002..7056ed9007cae 100644 --- a/python/taichi/ui/staging_buffer.py +++ b/python/taichi/ui/staging_buffer.py @@ -89,10 +89,10 @@ def copy_image_f32_to_u8(src: ti.template(), dst: ti.template(), c = src[i, j][k] c = max(0.0, min(1.0, c)) c = c * 255 - dst[i, j][k] = int(c) + dst[i, j][k] = ti.cast(c, u8) if num_components < 4: # alpha channel - dst[i, j][3] = 255 + dst[i, j][3] = u8(255) @ti.kernel @@ -103,7 +103,7 @@ def copy_image_u8_to_u8(src: ti.template(), dst: ti.template(), dst[i, j][k] = src[i, j][k] if num_components < 4: # alpha channel - dst[i, j][3] = 255 + dst[i, j][3] = u8(255) # ggui renderer always assumes the input image to be u8 RGBA