diff --git a/lib/convert.ts b/lib/convert.ts index b47b0c0..1c3a4cc 100644 --- a/lib/convert.ts +++ b/lib/convert.ts @@ -225,10 +225,8 @@ const lv_image_dsc_t ${out_name} = { } classify_pixel(value, bits) { - const tmp = 1 << (8 - bits); - let val = Math.round(value / tmp) * tmp; - if(val < 0) val = 0; - return val; + const shift = 8 - bits; + return value >> shift << shift; } format_to_c_array() {