An open API service indexing awesome lists of open source software.

https://github.com/changkun/enhance

A Go package for enhancing photographs (adjusting brightness, contrast, etc.)
https://github.com/changkun/enhance

Last synced: 3 months ago
JSON representation

A Go package for enhancing photographs (adjusting brightness, contrast, etc.)

Awesome Lists containing this project

README

          

# enhance

Package `enhance` is a Go implementation for enhancing photographs (adjusting brightness, contrast, etc.)

This project aims to reproduce https://github.com/yuki-koyama/enhancer.

## Usage

```go
package main

import (
"image"
"image/jpeg"
"log"
"os"

"changkun.de/x/enhance"
)

func main() {
f, err := os.Open("testdata/1.jpg")
if err != nil {
log.Fatal(err)
}
defer f.Close()

img, err := jpeg.Decode(f)
if err != nil {
log.Fatal(err)
}

enhanced := enhance.Image(img, enhance.Params{
Brightness: .5,
Contrast: .5,
Saturation: .5,
Temperature: .5,
Tint: .5,
})

f, err = os.Create("testdata/enhanced.jpg")
if err != nil {
log.Fatal(err)
}
defer f.Close()

if err := jpeg.Encode(f, enhanced, nil); err != nil {
log.Fatal(err)
}
}
```

## License

[MIT](./LICENSE)