Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chai2010/rawp
image format for me
https://github.com/chai2010/rawp
Last synced: 3 months ago
JSON representation
image format for me
- Host: GitHub
- URL: https://github.com/chai2010/rawp
- Owner: chai2010
- Created: 2015-06-18T01:52:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-24T01:08:55.000Z (almost 8 years ago)
- Last Synced: 2024-10-06T01:18:41.662Z (3 months ago)
- Language: Go
- Homepage: http://godoc.org/github.com/chai2010/rawp
- Size: 139 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
rawp
=====[![Build Status](https://travis-ci.org/chai2010/rawp.svg)](https://travis-ci.org/chai2010/rawp)
[![GoDoc](https://godoc.org/github.com/chai2010/rawp?status.svg)](https://godoc.org/github.com/chai2010/rawp)Install
=======1. `go get github.com/chai2010/rawp`
2. `go run hello.go`Example
=======This is a simple example:
```Go
package mainimport (
"bytes"
"fmt"
"image/jpeg"
"io/ioutil"
"log""github.com/chai2010/rawp"
)func main() {
var buf bytes.Buffer
var data []byte
var err error// Load file data
if data, err = ioutil.ReadFile("./testdata/lena.jpg"); err != nil {
log.Println(err)
}// Decode jpeg
m0, err := jpeg.Decode(bytes.NewReader(data))
if err != nil {
log.Println(err)
}// Encode rawp with snappy
if err = rawp.Encode(&buf, m0, &rawp.Options{UseSnappy: true}); err != nil {
log.Println(err)
}// Decode rawp
m1, err := rawp.Decode(&buf)
if err != nil {
log.Println(err)
}// save as jpeg
if err = jpeg.Encode(&buf, m1, nil); err != nil {
log.Println(err)
}
if err = ioutil.WriteFile("output.jpg", buf.Bytes(), 0666); err != nil {
log.Println(err)
}fmt.Println("Done")
}
```BUGS
====Report bugs to .
Thanks!