bimg
bimg copied to clipboard
Output size affects whether Image.Resize strips metadata
This might be a dupe of #194, but I'm not sure so I'm opening this.
Testing with this image:
Code:
package main
import (
"io/ioutil"
"os"
"github.com/h2non/bimg"
)
func main() {
var file, err = ioutil.ReadFile(os.Args[1])
if err != nil {
panic(err)
}
var img = bimg.NewImage(file)
var out []byte
out, err = img.Resize(1068, 0)
if err != nil {
panic(err)
}
ioutil.WriteFile("out.jpg", out, 0777)
}
If the width I resize it to is 1068 or less, the image comes out as expected - most metadata stripped, auto-rotated. If the width is 1069 or greater, metadata is not stripped, not even the orientation flag after rotating based on it - which means it comes out sideways.
The reason I think it's not the same thing is that in this comment on the other issue, @greut says that the metadata is stripped when the resize is a shrink, but the 1069 threshold is still a shrink in most dimensions for this image.