-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
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 What happened? 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 bounds: http://golang.org/src/pkg/image/gif/writer.go?s=5197:5226#L236 The attached patch appears to fix it. I'd be happy to make a CL once I figure out the review tools.
Attachments:
- buggy.gif (26883 bytes)
- fixed.gif (17539 bytes)
- gif_writer_subimage.patch (508 bytes)