Documentation
¶
Overview ¶
Package enhance provides image enhancement algorithms for adjusting brightness, contrast, saturation, temperature, and tint.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Image ¶
Image enhances a given image.Image and returns a new image.RGBA.
This method reproduces https://github.com/yuki-koyama/enhancer.
Example ¶
package main
import (
"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)
}
}
Output:
Types ¶
type Color ¶
type Color struct {
R, G, B float64
}
Color RGB from 0 to 1.
type Params ¶
type Params struct {
Brightness float64 `json:"brightness"`
Contrast float64 `json:"contrast"`
Saturation float64 `json:"saturation"`
Temperature float64 `json:"temperature"`
Tint float64 `json:"tint"`
}
Params defines the parameters for image enhancement. The values should in range [0, 1].
Click to show internal directories.
Click to hide internal directories.














