LVGLIMage.py:# RLE 编码器可以放出无效的流(控制字节'0x80'=字节跑 0个块)
作者: pingyun001创建于 2026年9月11日更新于 2026年9月11日
Minimal case (512 bytes of input), attached as repro_minimal.py:
import sys; sys.path.insert(0, '<lvgl>/scripts')
from LVGLImage import RLEImage, ColorFormat
BLK, TAIL = 4, bytes([0x11, 0x22, 0x33, 0xFF])
data = bytearray()
for i in range(125): # 125 pairwise different pixels
data += bytes([i, (i * 3) & 0xFF, (i * 5) & 0xFF, 0xFF])
data += TAIL * 3 # 3 identical pixels at the very end
img = RLEImage(cf=ColorFormat.ARGB8888, w=128, h=1, data=bytes(data))
print(img.rle_compress(data, BLK)[:8].hex(" "))Observed:
内容来源: lvgl/lvgl