perkeep/third_party/github.com/rwcarlsen/goexif/README.md

63 lines
1.3 KiB
Markdown
Raw Normal View History

goexif
======
Provides decoding of basic exif and tiff encoded data. Still in alpha - no guarantees.
Suggestions and pull requests are welcome. Functionality is split into two packages - "exif" and "tiff"
The exif package depends on the tiff package.
Documentation can be found at http://godoc.org/github.com/rwcarlsen/goexif
Like goexif? - Bitcoin tips welcome: 17w65FVqx196Qp7tfCCSLqyvsHUhiEEa7P
To install, in a terminal type:
```
go get github.com/rwcarlsen/goexif/exif
```
Or if you just want the tiff package:
```
go get github.com/rwcarlsen/goexif/tiff
```
Example usage:
```go
package main
import (
"os"
"log"
"fmt"
"github.com/rwcarlsen/goexif/exif"
)
func main() {
fname := "sample1.jpg"
f, err := os.Open(fname)
if err != nil {
log.Fatal(err)
}
x, err := exif.Decode(f)
defer f.Close()
if err != nil {
log.Fatal(err)
}
camModel, _ := x.Get(exif.Model)
date, _ := x.Get(exif.DateTimeOriginal)
fmt.Println(camModel.StringVal())
fmt.Println(date.StringVal())
focal, _ := x.Get(exif.FocalLength)
numer, denom := focal.Rat2(0) // retrieve first (only) rat. value
fmt.Printf("%v/%v", numer, denom)
}
```
<!--golang-->
goexif: merge upstream and document process. This commit contains changes following the process documented in the new file README.camlistore. Because we've used such and ad-hoc process managing this directory in the past, we will need a followup commit that manually merges changes that failed during 'git am'. This change passes 'make presubmit' and a quick examination by running 'devcam server' 'devcam put'ing some CR2 files and visiting /ui/. camlistored logs some messages like: 2013/10/13 13:55:11 filename "RAW_CANON_50D.CR2" exif = 2008-09-17 15:13:40 +0000 UTC, <nil> 2013/10/13 13:55:11 filename "RAW_CANON_5DMARK2_PREPROD.CR2" exif = 2008-10-29 20:05:00 +0000 UTC, <nil> And thumbnails are properly rotated in the web ui. commit 6034d9ed8d1fd31a8b7e80ffe4acc2c47b3ffd25 Author: Bill Thiede <git@xinu.tv> Date: Sun Sep 15 15:10:39 2013 -0700 Add support for TIFF based images, like CR2. This adds detection for TIFF images and skips the steps of removing JPEG and EXIF headers from the data before calling tiff.Decode. commit 2cc61b08a74f782b8665442ee5977649d3109971 Author: mewmew <random0x00@gmail.com> Date: Sat Jan 26 22:38:20 2013 +0100 tiff: Fix bug in convertVals, where floatVals was allocated more than once. commit 8206b5bee50e1d6d7e3b6b385e4ef0ef6e029137 Author: Robert Carlsen <rwcarlsen@gmail.com> Date: Wed Jan 23 15:08:48 2013 -0600 vetted fix from Fatal to Fatalf commit 4347b209f9f0396dd2cca9dbf25cb7f519148ec4 Author: Robert Carlsen <rwcarlsen@gmail.com> Date: Thu Jan 10 20:07:05 2013 -0600 analytics Change-Id: If13a7dbacd35ee2a49315bacf2d7cfc7795c0cc2
2013-10-10 05:00:24 +00:00
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/5e166f74cdb82b999ccd84e3c4dc4348 "githalytics.com")](http://githalytics.com/rwcarlsen/goexif)