Documentation ¶
Overview ¶
Package orientation provides functions to use orientation of EXIF.
Example ¶
package main import ( "bytes" "image" "image/jpeg" "io/ioutil" "log" "os" orientation "github.com/takumakei/exif-orientation" ) func main() { b, err := ioutil.ReadFile("./examples/Landscape_7.jpg") if err != nil { log.Fatal(err) } r := bytes.NewReader(b) img, _, err := image.Decode(r) if err != nil { log.Fatal(err) } r.Reset(b) o, _ := orientation.Read(r) img = orientation.Normalize(img, o) f, err := os.Create("normalized.jpg") if err != nil { log.Fatal(err) } defer f.Close() if err := jpeg.Encode(f, img, &jpeg.Options{Quality: jpeg.DefaultQuality}); err != nil { log.Fatal(err) } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Orientation ¶
type Orientation int
Orientation
1:TopLeft 2:TopRight FFFFFFFF FFFFFFFF FF FF FFFFFF FFFFFF FF FF FF FF FF FF 8:LeftBottom 5:LeftTop FF FFFFFFFFFFFF FFFFFFFFFFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFFFFFFFFFF FF FF FFFFFFFFFFFF 6:RightTop 7:RightBottom FF FF FF FF FF FF FFFFFF FFFFFF FF FF FFFFFFFF FFFFFFFF 3:BottomRight 4:BottomLeft
const ( TopLeft Orientation = 1 + iota TopRight BottomRight BottomLeft LeftTop RightTop RightBottom LeftBottom )
func Read ¶
func Read(r io.Reader) (Orientation, error)
Read returns an orientation, TopLeft in case of err != nil.
func (Orientation) String ¶
func (i Orientation) String() string
Click to show internal directories.
Click to hide internal directories.