Fix incorrect type choise condition in image compressor (#2434)

This commit is contained in:
あく
2023-02-27 01:29:42 +09:00
committed by GitHub
parent 3efb7d4050
commit 1d55aee39c

View File

@@ -105,7 +105,7 @@ def file2image(file):
data_enc = bytearray([len(data_enc) & 0xFF, len(data_enc) >> 8]) + data_enc data_enc = bytearray([len(data_enc) & 0xFF, len(data_enc) >> 8]) + data_enc
# Use encoded data only if its length less than original, including header # Use encoded data only if its length less than original, including header
if len(data_enc) < len(data_bin) + 1: if len(data_enc) + 2 < len(data_bin) + 1:
data = b"\x01\x00" + data_enc data = b"\x01\x00" + data_enc
else: else:
data = b"\x00" + data_bin data = b"\x00" + data_bin