diff --git a/common/nori/image.go b/common/nori/image.go index fc485c5..b0fab41 100644 --- a/common/nori/image.go +++ b/common/nori/image.go @@ -55,6 +55,9 @@ func (i *Image) Decode(rd *bufio.Reader, palette *PaletteSection) error { if red == 0xff && blue == 0xff { alpha = 0x00 } + if red == 0x00 && blue == 0x00 && green == 0xff { + alpha = 0x00 + } col := &color.RGBA{ red, green, blue, alpha, @@ -75,6 +78,10 @@ func (i *Image) Decode(rd *bufio.Reader, palette *PaletteSection) error { rgb[0], rgb[1], rgb[2], alpha, } + + if rgb[0] == 0x00 && rgb[1] == 0xff && rgb[2] == 0x00 { + alpha = 0x00 + } if rgb[0] == 0xff && rgb[2] == 0xff { alpha = 0x00 } diff --git a/common/nori/nori_test/palette.apng b/common/nori/nori_test/palette.apng index 76b14be..bbd7a8a 100755 Binary files a/common/nori/nori_test/palette.apng and b/common/nori/nori_test/palette.apng differ diff --git a/common/nori/reader.go b/common/nori/reader.go index 418fe0b..084a21d 100644 --- a/common/nori/reader.go +++ b/common/nori/reader.go @@ -157,9 +157,16 @@ func (n *Reader) decodePalette() error { if err != nil { return err } + alpha := uint8(0xff) + if rgb[0] == 0x00 && rgb[1] == 0xff && rgb[2] == 0x00 { + alpha = 0x00 + } + if rgb[0] == 0xff && rgb[2] == 0xff { + alpha = 0x00 + } cp.Palette[i] = &color.RGBA{ rgb[0], rgb[1], rgb[2], - 0xff, + alpha, } }