{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/13724","labels_url":"https://api.github.com/repos/golang/go/issues/13724/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/13724/comments","events_url":"https://api.github.com/repos/golang/go/issues/13724/events","html_url":"https://github.com/golang/go/issues/13724","id":123743970,"number":13724,"title":"image/gif.GIF: last color in Palette is different","user":{"login":"pierrre","id":131535,"avatar_url":"https://avatars.githubusercontent.com/u/131535?v=3","gravatar_id":"","url":"https://api.github.com/users/pierrre","html_url":"https://github.com/pierrre","followers_url":"https://api.github.com/users/pierrre/followers","following_url":"https://api.github.com/users/pierrre/following{/other_user}","gists_url":"https://api.github.com/users/pierrre/gists{/gist_id}","starred_url":"https://api.github.com/users/pierrre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierrre/subscriptions","organizations_url":"https://api.github.com/users/pierrre/orgs","repos_url":"https://api.github.com/users/pierrre/repos","events_url":"https://api.github.com/users/pierrre/events{/privacy}","received_events_url":"https://api.github.com/users/pierrre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-24T01:33:25Z","updated_at":"2015-12-24T01:33:25Z","closed_at":null,"body":"Go version: 1.6beta1 (but it's not relevant)\r\n\r\nI tried to decode an animated GIF image. (https://raw.githubusercontent.com/pierrre/imageserver/master/testdata/animated.gif)\r\nI get a GIF with a `Palette` `ColorModel`, and a slice of `Paletted` images.\r\nIf I compare the global palette, with the palette of each frame, the last color is different.\r\n\r\nI wrote a small program:\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"bytes\"\r\n\t\"fmt\"\r\n\t\"image/color\"\r\n\t\"image/gif\"\r\n\t\"io/ioutil\"\r\n)\r\n\r\nfunc main() {\r\n\tb, err := ioutil.ReadFile(\"/home/pierre/Go/src/github.com/pierrre/imageserver/testdata/animated.gif\")\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tg, err := gif.DecodeAll(bytes.NewReader(b))\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tif g.Config.ColorModel == nil {\r\n\t\tfmt.Println(\"no global color model\")\r\n\t\treturn\r\n\t}\r\n\tpa, ok := g.Config.ColorModel.(color.Palette)\r\n\tif !ok {\r\n\t\tfmt.Println(\"global color model is not a Palette\")\r\n\t\treturn\r\n\t}\r\n\tif len(pa) == 0 {\r\n\t\tfmt.Println(\"global palette is empty\")\r\n\t\treturn\r\n\t}\r\n\tfor i, p := range g.Image {\r\n\t\tif len(p.Palette) != len(pa) {\r\n\t\t\tfmt.Printf(\"image %d: palette length is not equal: current=%d, global=%d\\n\", i, len(p.Palette), len(pa))\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tfor j := range p.Palette {\r\n\t\t\tif p.Palette[j] != pa[j] {\r\n\t\t\t\tfmt.Printf(\"image %d: palette index %d: color is not equal: current=%#v, global=%#v\\n\", i, j, p.Palette[j], pa[j])\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfmt.Printf(\"background index: %d\\n\", g.BackgroundIndex)\r\n}\r\n```\r\n\r\nI get:\r\n```\r\nimage 0: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 1: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 2: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 3: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 4: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 5: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 6: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 7: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 8: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 9: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 10: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 11: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 12: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 13: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 14: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 15: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 16: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 17: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 18: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 19: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 20: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 21: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 22: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 23: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 24: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 25: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 26: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 27: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 28: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 29: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 30: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 31: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 32: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 33: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 34: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nimage 35: palette index 255: color is not equal: current=color.RGBA{R:0x0, G:0x0, B:0x0, A:0x0}, global=color.RGBA{R:0xff, G:0xff, B:0xff, A:0xff}\r\nbackground index: 255\r\n```\r\nAt index 255, the color is black in the global palette, and white in all frames.\r\n\r\nIf the `ColorModel` is defined in `GIF`, and it's a non empty `Palette`, I expect to have the same `Palette` in all frames.\r\n\r\nIs it related to the background color index?\r\n\r\nThank you."}}