mirror of https://github.com/perkeep/perkeep.git
goexif: synced with upstream
Change-Id: I6198e6c7501d3c3c15671389c0065ee613d1486e
This commit is contained in:
parent
9b8c0bffc4
commit
174e4da790
|
@ -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
|
||||
}
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue