Debian Codegraph @

README.md

raw
1 goexif
2 ======
3
4 [![GoDoc](https://godoc.org/github.com/rwcarlsen/goexif?status.svg)](https://godoc.org/github.com/rwcarlsen/goexif)
5
6 Provides decoding of basic exif and tiff encoded data. Still in alpha - no guarantees.
7 Suggestions and pull requests are welcome. Functionality is split into two packages - "exif" and "tiff"
8 The exif package depends on the tiff package.
9
10 Like goexif? - Bitcoin Cash tips welcome: 1DrU5V37nTXuv4vnRLVpahJEjhdATNgoBh
11
12 To install, in a terminal type:
13
14 ```
15 go get github.com/rwcarlsen/goexif/exif
16 ```
17
18 Or if you just want the tiff package:
19
20 ```
21 go get github.com/rwcarlsen/goexif/tiff
22 ```
23
24 Example usage:
25
26 ```go
27 package main
28
29 import (
30 "fmt"
31 "log"
32 "os"
33
34 "github.com/rwcarlsen/goexif/exif"
35 "github.com/rwcarlsen/goexif/mknote"
36 )
37
38 func ExampleDecode() {
39 fname := "sample1.jpg"
40
41 f, err := os.Open(fname)
42 if err != nil {
43 log.Fatal(err)
44 }
45
46 // Optionally register camera makenote data parsing - currently Nikon and
47 // Canon are supported.
48 exif.RegisterParsers(mknote.All...)
49
50 x, err := exif.Decode(f)
51 if err != nil {
52 log.Fatal(err)
53 }
54
55 camModel, _ := x.Get(exif.Model) // normally, don't ignore errors!
56 fmt.Println(camModel.StringVal())
57
58 focal, _ := x.Get(exif.FocalLength)
59 numer, denom, _ := focal.Rat2(0) // retrieve first (only) rat. value
60 fmt.Printf("%v/%v", numer, denom)
61
62 // Two convenience functions exist for date/time taken and GPS coords:
63 tm, _ := x.DateTime()
64 fmt.Println("Taken: ", tm)
65
66 lat, long, _ := x.LatLong()
67 fmt.Println("lat, long: ", lat, ", ", long)
68 }
69 ```
70
71 <!--golang-->
72 [![githalytics.com alpha](https://cruel-carlota.pagodabox.com/5e166f74cdb82b999ccd84e3c4dc4348 "githalytics.com")](http://githalytics.com/rwcarlsen/goexif)