You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+131-2Lines changed: 131 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,14 +8,16 @@ The blog post [Updating EXIF metadata in JavaScript (and WebAssembly)](https://m
8
8
9
9
## Important
10
10
11
-
As of this writing the majority of EXIF tags are _not_ supported. Currently only EXIF tags of types `ASCII`and `BYTE` are supported. This is not ideal but I am still trying to get familiar with the requirements of the `go-exif` package. Contributions and patches for the other remaining EXIF tag types is welcomed.
11
+
As of this writing the majority of EXIF tags are _not_ supported. Currently only EXIF tags of with the following EXIF types are supported: `ASCII`, `BYTE`, `RATIONAL`and `SRATIONAL` are supported. This is not ideal but I am still trying to get familiar with the requirements of the `go-exif` package. Contributions and patches for the other remaining EXIF tag types is welcomed.
The properties passed to the [UpdateExif](https://pkg.go.dev/github.com/sfomuseum/go-exif-update#UpdateExif) method are assumed to be suitably typed to be used as input for the [exif.SetStandardWithName](https://pkg.go.dev/github.com/dsoprea/go-exif/v3#IfdBuilder.SetStandardWithName) method. For anything other than simple strings this can become a fairly involved process. I am still trying the understand the `go-exif` documentation and requirements so any guidance I have to offer remains limited.
49
+
50
+
This package also provides a convenience [PrepareAndUpdateExif](https://pkg.go.dev/github.com/sfomuseum/go-exif-update#PrepareUpdateExif) method which attempts to translate EXIF property values in to their corresponding `go-exif` type before invoking the `UpdateExif` method. For example:
44
51
45
52
```
53
+
exif_props := map[string]interface{}{
54
+
"FNumber": "11/1", // FNumber is stored as a `RATIONAL` value rather than as a string (or `ASCI`)
The `PrepareAndUpdateExif` method also supports a limited set of custom non-standard tags. These are provided to simplify the process of assigning multiple or complex EXIF tags.
69
+
70
+
The list of currently supported non-standard tags is:
71
+
72
+
| Name | Value | Description | Notes |
73
+
| --- | --- | --- | --- |
74
+
|`X-Latitude`| float64 | Assign a decimal latitude value in to its corresponding `GPSLatitude` and `GPSLatitudeRef` properties. ||
75
+
|`X-Longitude`| float64 | Assign a decimal longitude value in to its corresponding `GPSLongitude` and `GPSLongitudeRef` properties. ||
48
76
49
77
## Tools
50
78
@@ -86,6 +114,8 @@ Copyright true
86
114
ImageWidth false
87
115
```
88
116
117
+
_As of this writing non-standard tags, described above, are not considered when processing tags._
118
+
89
119
### tags-supported
90
120
91
121
Command-line tool that prints a list of EXIF tag names, sorted alphabetically, that are supported by the sfomuseum/go-exif-update package.
@@ -98,6 +128,8 @@ Usage:
98
128
./bin/tags-supported
99
129
```
100
130
131
+
_As of this writing non-standard tags, described above, are not considered when listing supported tags._
132
+
101
133
### update-exif
102
134
103
135
Command-line tool for updating the EXIF properties in one or more JPEG images.
@@ -130,6 +162,26 @@ Exif.Image.Artist Ascii 4 Bob
130
162
Exif.Image.Copyright Ascii 6 Alice
131
163
```
132
164
165
+
This tool uses the `PrepareAndUpdateExif` method and supports non-standard tags, both described above. For example:
Copy file name to clipboardExpand all lines: cmd/update-exif/main.go
-12Lines changed: 0 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,6 @@ func main() {
16
16
varproperties multi.KeyValueString
17
17
flag.Var(&properties, "property", "One or more {TAG}={VALUE} EXIF properties. {TAG} must be a recognized EXIF tag.")
18
18
19
-
lat:=flag.Float64("latitude", 0.0, "")
20
-
lon:=flag.Float64("longitude", 0.0, "")
21
-
22
19
flag.Usage=func() {
23
20
fmt.Fprintf(os.Stderr, "Command-line tool for updating the EXIF properties in one or more JPEG images. Images are not updated in place but written to STDOUT.\n\n")
0 commit comments