goexif: synced with upstream

Change-Id: I6198e6c7501d3c3c15671389c0065ee613d1486e
This commit is contained in:
mpl 2012-11-23 11:10:43 +01:00
parent 9b8c0bffc4
commit 174e4da790
2 changed files with 37 additions and 1 deletions

View File

@ -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
}

View File

@ -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))