mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Round and clamp palette before encoding
This commit is contained in:
parent
00890dd0d1
commit
1f827214d2
@ -105,7 +105,8 @@ def palette_encode(data, format='rgb8'):
|
|||||||
"""
|
"""
|
||||||
if format != 'rgb8':
|
if format != 'rgb8':
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
enc = base64.b64encode(np.uint8(data[:,:3]*255.0))
|
clamp = np.maximum(0, np.minimum(255, np.round(data[:,:3]*255.0)))
|
||||||
|
enc = base64.b64encode(np.uint8(clamp))
|
||||||
return ['rgb8'] + [enc[i:i+64] for i in range(0, len(enc), 64)]
|
return ['rgb8'] + [enc[i:i+64] for i in range(0, len(enc), 64)]
|
||||||
|
|
||||||
class _AttrDict(dict):
|
class _AttrDict(dict):
|
||||||
|
Loading…
Reference in New Issue
Block a user