What does 'go version' print?
go version devel +8e5787506b59 Tue Apr 15 15:52:23 2014 -0400 + linux/amd64
What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Create an image in a GIF where the bounds of the Paletted image is different from the
backing pixel slice. For example, create an image using Paletted.SubImage() that is
narrower than the original image.
2. Attempt to encode this GIF.
Example (needs file access): http://play.golang.org/p/Ck6A7ih6Hv
The frame created from the subimage looks corrupted (example in buggy.gif)
What should have happened instead?
The frame should look correct (example in fixed.gif)
Please provide any additional information below.
Looks like this is due to the "common mistake" described at
http://blog.golang.org/go-image-package#TOC_4. where it is assumed that the backing data
matches the dimensions of the image.
The encoder attempts to write the entire Px slice instead of respecting the image
The attached patch appears to fix it. I'd be happy to make a CL once I figure out the
Note that the examples are animated GIFs (the issue tracker only shows the first frame
unless you download them). This can affect single frame GIFs as well, but I wanted to
make the examples clearly distinct from issue #6635 (image/gif: encoder does not honor