Closed
Description
The following program fails:
package main
import (
"bytes"
"fmt"
"image/gif"
"reflect"
)
func main() {
data := []byte("GIF89a\n\x0000000,\x00\x000\x00\n\x00\n\x00\x80000000\x02\b\xf01u\xb9\xfdal\x05\x00;")
img, err := gif.Decode(bytes.NewReader(data))
if err != nil {
panic(err)
}
var w bytes.Buffer
err = gif.Encode(&w, img, nil)
if err != nil {
panic(err)
}
img1, err := gif.Decode(&w)
if err != nil {
panic(err)
}
if !reflect.DeepEqual(img.Bounds(), img1.Bounds()) {
fmt.Printf("img0: %#v\n", img.Bounds())
fmt.Printf("img1: %#v\n", img1.Bounds())
panic("bounds changed")
}
}
img0: image.Rectangle{Min:image.Point{X:0, Y:48}, Max:image.Point{X:10, Y:58}}
img1: image.Rectangle{Min:image.Point{X:0, Y:0}, Max:image.Point{X:10, Y:10}}
panic: bounds changed
Bounds.Min should be preserved by Encode.
go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64