• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cshum / imagor / 15233123730

25 May 2025 02:03AM UTC coverage: 92.117% (+2.4%) from 89.678%
15233123730

Pull #544

github

cshum
Merge remote-tracking branch 'origin/vips-vipsgen' into vips-vipsgen
Pull Request #544: feat: vipsgen migration

307 of 345 new or added lines in 6 files covered. (88.99%)

6 existing lines in 1 file now uncovered.

4861 of 5277 relevant lines covered (92.12%)

1.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.46
/processor/vipsprocessor/exif.go
1
package vipsprocessor
2

3
import "C"
4
import (
5
        "strconv"
6
        "strings"
7
)
8

9
// exifTags to extract, true to cast as int
10
var exifTags = map[string]bool{
11
        "exif-ifd0-Orientation":           true,
12
        "exif-ifd0-ResolutionUnit":        true,
13
        "exif-ifd0-YCbCrPositioning":      true,
14
        "exif-ifd1-Compression":           true,
15
        "exif-ifd2-ExposureProgram":       true,
16
        "exif-ifd2-ISOSpeedRatings":       true,
17
        "exif-ifd2-MeteringMode":          true,
18
        "exif-ifd2-Flash":                 true,
19
        "exif-ifd2-ColorSpace":            true,
20
        "exif-ifd2-PixelXDimension":       true,
21
        "exif-ifd2-PixelYDimension":       true,
22
        "exif-ifd2-SensingMethod":         true,
23
        "exif-ifd2-ExposureMode":          true,
24
        "exif-ifd2-WhiteBalance":          true,
25
        "exif-ifd2-FocalLengthIn35mmFilm": true,
26
        "exif-ifd2-SceneCaptureType":      true,
27
}
28

29
func exifStringShort(s string) string {
1✔
30
        i := strings.Index(s, " (")
1✔
31
        if i > -1 {
2✔
32
                return s[:i]
1✔
33
        }
1✔
NEW
34
        return s
×
35
}
36

37
func extractExif(rawExif map[string]string) map[string]any {
1✔
38
        var exif = map[string]any{}
1✔
39
        for tag, value := range rawExif {
2✔
40
                if len(tag) < 10 {
2✔
41
                        continue
1✔
42
                }
43
                name := tag[10:]
1✔
44
                value = strings.TrimSpace(exifStringShort(value))
1✔
45
                if value == "" {
2✔
46
                        continue
1✔
47
                }
48
                if exifTags[tag] {
2✔
49
                        val, err := strconv.Atoi(value)
1✔
50
                        if err == nil {
2✔
51
                                exif[name] = val
1✔
52
                        } else {
1✔
NEW
53
                                exif[name] = value
×
NEW
54
                        }
×
55
                } else {
1✔
56
                        exif[name] = value
1✔
57
                }
1✔
58
        }
59
        return exif
1✔
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc