Add image.Exif

Note that we will probably need to add some metadata cache for this to scale.

Fixes #4600
This commit is contained in:
Bjørn Erik Pedersen 2019-08-29 10:18:51 +02:00
parent 8a8d4a6d97
commit 28143397d6
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
12 changed files with 483 additions and 2 deletions

View file

@ -332,6 +332,32 @@ func TestSVGImageContent(t *testing.T) {
c.Assert(content.(string), qt.Contains, `<svg height="100" width="100">`)
}
func TestImageExif(t *testing.T) {
c := qt.New(t)
image := fetchImage(c, "sunset.jpg")
x, err := image.Exif()
c.Assert(err, qt.IsNil)
c.Assert(x, qt.Not(qt.IsNil))
c.Assert(x.Date.Format("2006-01-02"), qt.Equals, "2017-10-27")
// Malaga: https://goo.gl/taazZy
c.Assert(x.Lat, qt.Equals, float64(36.59744166666667))
c.Assert(x.Long, qt.Equals, float64(-4.50846))
v, found := x.Values["LensModel"]
c.Assert(found, qt.Equals, true)
lensModel, ok := v.(string)
c.Assert(ok, qt.Equals, true)
c.Assert(lensModel, qt.Equals, "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM")
resized, _ := image.Resize("300x200")
x2, _ := resized.Exif()
c.Assert(x2, qt.Equals, x)
}
func TestImageOperationsGolden(t *testing.T) {
c := qt.New(t)
c.Parallel()