diff --git a/third_party/github.com/camlistore/goexif/cmd/main.go b/third_party/github.com/camlistore/goexif/cmd/main.go new file mode 100644 index 000000000..a346c2829 --- /dev/null +++ b/third_party/github.com/camlistore/goexif/cmd/main.go @@ -0,0 +1,36 @@ +package main + +import ( + "flag" + "fmt" + "log" + "os" + + "camlistore.org/third_party/github.com/rwcarlsen/goexif/exif" + "camlistore.org/third_party/github.com/rwcarlsen/goexif/tiff" +) + +func main() { + flag.Parse() + fname := flag.Arg(0) + + f, err := os.Open(fname) + if err != nil { + log.Fatal(err) + } + + x, err := exif.Decode(f) + if err != nil { + log.Fatal(err) + } + + x.Walk(Walker{}) +} + +type Walker struct{} + +func (_ Walker) Walk(name string, tag *tiff.Tag) error { + data, _ := tag.MarshalJSON() + fmt.Printf("%v: %v\n", name, string(data)) + return nil +} diff --git a/third_party/github.com/camlistore/goexif/tiff/tag.go b/third_party/github.com/camlistore/goexif/tiff/tag.go index d4c74f2ec..2ad3b1de3 100644 --- a/third_party/github.com/camlistore/goexif/tiff/tag.go +++ b/third_party/github.com/camlistore/goexif/tiff/tag.go @@ -114,7 +114,7 @@ func (t *Tag) convertVals() { switch t.Fmt { case 2: // ascii string - t.strVal = string(t.Val) + t.strVal = string(t.Val[:len(t.Val)-1]) case 1: var v uint8 t.intVals = make([]int64, int(t.Ncomp))