40 lines
658 B
Go
40 lines
658 B
Go
//go:build ignore
|
|
|
|
package main
|
|
|
|
import (
|
|
"image"
|
|
"image/color"
|
|
"image/png"
|
|
"os"
|
|
)
|
|
|
|
type Reshade struct{ image.Image }
|
|
|
|
func (rs Reshade) ColorModel() color.Model { return rs.Image.ColorModel() }
|
|
func (rs Reshade) Bounds() image.Rectangle { return rs.Image.Bounds() }
|
|
func (rs Reshade) At(x, y int) color.Color {
|
|
c := rs.Image.At(x, y)
|
|
r, g, b, a := c.RGBA()
|
|
// minus 19 blue
|
|
return color.RGBA{
|
|
uint8(r >> 8),
|
|
uint8(g >> 8),
|
|
uint8(b>>8) - 8*8,
|
|
uint8(a >> 8),
|
|
}
|
|
}
|
|
|
|
func check(err error) {
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
img, err := png.Decode(os.Stdin)
|
|
check(err)
|
|
err = png.Encode(os.Stdout, Reshade{img})
|
|
check(err)
|
|
}
|