31cd20a70e
The GIF format allows for an image to contain a global color table which might be used for some or every frame in an animated GIF. This palette contains 24-bit opaque RGB values. An individual frame may use the global palette and enable transparency by picking one number to be transparent, instead of the color value in the palette. image/gif decodes a GIF, which contains an []*image.Paletted that holds each frame. When decoded, if a frame has a transparent color and uses the global palette, a copy of the global []color.Color is made, and the transparency color index is replaced with color.RGBA{}. When encoding a GIF, each frame's palette is encoded to the form it might exist in a GIF, up to 768 bytes "RGBRGBRGBRGB...". If a frame's encoded palette is equal to the encoded global color table, the frame will be encoded with the flag set to use the global color table, otherwise the frame's palette will be included. So, if the color in the global color table that matches the transparent index of one frame wasn't black (and it frequently is not), reencoding a GIF will likely result in a larger file because each frame's palette will have to be encoded inline. This commit takes a frame's transparent color index into account when comparing an individual image.Paletted's encoded color table to the global color table. Fixes #22137 Change-Id: I5460021da6e4d7ce19198d5f94a8ce714815bc08 Reviewed-on: https://go-review.googlesource.com/68313 Reviewed-by: Nigel Tao <nigeltao@golang.org> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
favicon.ico | ||
LICENSE | ||
PATENTS | ||
README.md | ||
robots.txt |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Contributing
Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project does not use GitHub pull requests, and that we use the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.