diff --git a/internal/meta/data.go b/internal/meta/data.go index 2de2da15f..a33df160b 100644 --- a/internal/meta/data.go +++ b/internal/meta/data.go @@ -38,8 +38,8 @@ type Data struct { Lat float32 `meta:"-"` Lng float32 `meta:"-"` Altitude int `meta:"GlobalAltitude"` - Width int `meta:"ImageWidth"` - Height int `meta:"ImageHeight"` + Width int `meta:"PixelXDimension,ImageWidth,ExifImageWidth,SourceImageWidth"` + Height int `meta:"PixelYDimension,ImageHeight,ImageLength,ExifImageHeight,SourceImageHeight"` Orientation int `meta:"-"` Rotation int `meta:"Rotation"` All map[string]string diff --git a/internal/meta/exif.go b/internal/meta/exif.go index b7ab33091..4cf711d36 100644 --- a/internal/meta/exif.go +++ b/internal/meta/exif.go @@ -256,21 +256,21 @@ func (data *Data) Exif(fileName string) (err error) { data.UniqueID = value } - if value, ok := tags["ImageWidth"]; ok { + if value, ok := tags["PixelXDimension"]; ok { if i, err := strconv.Atoi(value); err == nil { data.Width = i } - } else if value, ok := tags["PixelXDimension"]; ok { + } else if value, ok := tags["ImageWidth"]; ok { if i, err := strconv.Atoi(value); err == nil { data.Width = i } } - if value, ok := tags["ImageLength"]; ok { + if value, ok := tags["PixelYDimension"]; ok { if i, err := strconv.Atoi(value); err == nil { data.Height = i } - } else if value, ok := tags["PixelYDimension"]; ok { + } else if value, ok := tags["ImageLength"]; ok { if i, err := strconv.Atoi(value); err == nil { data.Height = i } diff --git a/internal/meta/exif_test.go b/internal/meta/exif_test.go index 551f59a83..96b3e420b 100644 --- a/internal/meta/exif_test.go +++ b/internal/meta/exif_test.go @@ -19,8 +19,8 @@ func TestExif(t *testing.T) { assert.Equal(t, "2020-01-01T17:28:23Z", data.TakenAtLocal.Format("2006-01-02T15:04:05Z")) assert.Equal(t, "Example file for development", data.Description) assert.Equal(t, "This is a legal notice", data.Copyright) - assert.Equal(t, 2736, data.Height) - assert.Equal(t, 3648, data.Width) + assert.Equal(t, 540, data.Height) + assert.Equal(t, 720, data.Width) assert.Equal(t, float32(52.45969), data.Lat) assert.Equal(t, float32(13.321832), data.Lng) assert.Equal(t, 0, data.Altitude) @@ -84,8 +84,8 @@ func TestExif(t *testing.T) { assert.Equal(t, "", data.Keywords) assert.Equal(t, "DCIM\\100GOPRO", data.Description) assert.Equal(t, "", data.Copyright) - assert.Equal(t, 2880, data.Height) - assert.Equal(t, 3840, data.Width) + assert.Equal(t, 180, data.Height) + assert.Equal(t, 240, data.Width) assert.Equal(t, float32(0), data.Lng) assert.Equal(t, 0, data.Altitude) assert.Equal(t, "1/2462", data.Exposure) diff --git a/internal/photoprism/metadata_test.go b/internal/photoprism/metadata_test.go index ed3b8cf0b..d3afb87b1 100644 --- a/internal/photoprism/metadata_test.go +++ b/internal/photoprism/metadata_test.go @@ -41,8 +41,8 @@ func TestMediaFile_Exif_JPEG(t *testing.T) { assert.Equal(t, float32(-33.45347), info.Lat) assert.Equal(t, float32(25.764645), info.Lng) assert.Equal(t, 190, info.Altitude) - assert.Equal(t, 2048, info.Width) - assert.Equal(t, 1365, info.Height) + assert.Equal(t, 497, info.Width) + assert.Equal(t, 331, info.Height) assert.Equal(t, false, info.Flash) assert.Equal(t, "", info.Description) t.Logf("UTC: %s", info.TakenAt.String()) @@ -74,8 +74,8 @@ func TestMediaFile_Exif_JPEG(t *testing.T) { assert.Equal(t, float32(10), info.FNumber) assert.Equal(t, 200, info.Iso) assert.Equal(t, 0, info.Altitude) - assert.Equal(t, 2048, info.Width) - assert.Equal(t, 2048, info.Height) + assert.Equal(t, 331, info.Width) + assert.Equal(t, 331, info.Height) assert.Equal(t, true, info.Flash) assert.Equal(t, "", info.Description) t.Logf("UTC: %s", info.TakenAt.String())