Open FooSoft opened 5 years ago
I should add that this was taken on a Huawei Mate SE, and all pictures it saves have this problem.
Same here with pictures of a Huawei P20. Here is the output of a sample picture created with ExifTool: https://pastebin.com/bWF8Nus5
I was able to solve my problem by ignoring non-critical decoding errors and using DateTime() instead of Get(exif.DateTimeOriginal).
@FooSoft As you are trying to extract GPS metadata, maybe the LatLong() function works for you.
Here is my snippet that finally works:
x, err := exif.Decode(f)
if err != nil {
if exif.IsCriticalError(err) {
return nil, err
}
}
defer f.Close()
dt, err := x.DateTime()
if err != nil {
return nil, err
}
// Use dt...
@mrauh thanks for the example, I did not realize IsCriticalError
was something that I should be looking for; does not appear to be very intuitive.
Attempting to extract GPS metadata from an image known to contain it causes the following error to be logged:
Go version:
Test code (basically copy-paste of sample):
Image file: https://github.com/FooSoft/goldsmith-components/raw/master/plugins/exif/testdata/source/osaka.jpg