# tiff **Repository Path**: chai2010/tiff ## Basic Information - **Project Name**: tiff - **Description**: Rich TIFF/BigTIFF/GeoTIFF decoder/encoder for Go (Pure Go/Zero Dependencies) - **Primary Language**: Go - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2015-02-25 - **Last Updated**: 2022-07-26 ## Categories & Tags **Categories**: image-processing **Tags**: None ## README TIFF for Go =========== PkgDoc: [http://godoc.org/github.com/chai2010/tiff](http://godoc.org/github.com/chai2010/tiff) **Features:** 1. Support BigTiff 2. Support decode multiple image 3. Support decode subifd image 4. Support RGB format 5. Support Float DataType 6. More ... Install ======= 1. `go get github.com/chai2010/tiff` 2. `go run hello.go` Example ======= ```Go package main import ( "bytes" "fmt" "io/ioutil" "log" "path/filepath" tiff "github.com/chai2010/tiff" ) func main() { var data []byte var err error var files = []string{ "./testdata/BigTIFFSamples/BigTIFFSubIFD8.tif", "./testdata/multipage/multipage-gopher.tif", } for _, filename := range files { // Load file data if data, err = ioutil.ReadFile(filename); err != nil { log.Fatal(err) } // Decode tiff m, errors, err := tiff.DecodeAll(bytes.NewReader(data)) if err != nil { log.Println(err) } // Encode tiff for i := 0; i < len(m); i++ { for j := 0; j < len(m[i]); j++ { newname := fmt.Sprintf("%s-%02d-%02d.tiff", filepath.Base(filename), i, j) if errors[i][j] != nil { log.Printf("%s: %v\n", newname, err) continue } var buf bytes.Buffer if err = tiff.Encode(&buf, m[i][j], nil); err != nil { log.Fatal(err) } if err = ioutil.WriteFile(newname, buf.Bytes(), 0666); err != nil { log.Fatal(err) } fmt.Printf("Save %s ok\n", newname) } } } } ``` BUGS ==== Report bugs to . Thanks!