From c0b8b8a9250ea942dd5052b7ce2f38334133bfbc Mon Sep 17 00:00:00 2001 From: heyarne Date: Mon, 21 Mar 2022 00:09:42 +0100 Subject: [PATCH] Fix clipping when converting --- epd/epd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epd/epd.go b/epd/epd.go index ef6be1f..b73d0a5 100644 --- a/epd/epd.go +++ b/epd/epd.go @@ -63,7 +63,7 @@ func ConvertImage(input *io.Reader, width int, height int) ([]byte, error) { // the actual conversion works by packing two nibbles together in a byte var result = make([]byte, (width*height+1)/2) for i, p := range dst.Pix { - res := uint8((uint16(p) + 8) / 16) + res := p / 16 if i%2 == 0 { res = res << 4 }