Fix clipping when converting
This commit is contained in:
parent
a98f3a0b63
commit
c0b8b8a925
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue