Golang image.Alpha16.At function example
package image
func (p *Alpha16) At(x, y int) color.Color
Golang image.Alpha16.At function usage example
package main
import (
"fmt"
"image"
"image/png"
"os"
)
func init() {
image.RegisterFormat("png", "png", png.Decode, png.DecodeConfig)
}
func main() {
imgfile, err := os.Open("./img.png")
if err != nil {
fmt.Println("img.png file not found!")
os.Exit(1)
}
defer imgfile.Close()
img, _, err := image.Decode(imgfile)
bounds := img.Bounds()
alpha16 := image.NewAlpha16(bounds) // <-- here
// see http://golang.org/pkg/image/color/#Color
color := alpha16.At(100,100) // <--- HERE
fmt.Println(color)
fmt.Println(color.RGBA())
}
Reference :
Advertisement
Something interesting
Tutorials
+21.6k Golang : Encrypt and decrypt data with TripleDES
+12k Golang : Convert a rune to unicode style string \u
+10.5k Golang : Select region of interest with mouse click and crop from image
+17.1k Golang : Capture stdout of a child process and act according to the result
+11.3k Golang : Intercept and process UNIX signals example
+15.2k Golang : Get HTTP protocol version example
+20k Golang : Convert(cast) bytes.Buffer or bytes.NewBuffer type to io.Reader
+15.8k Golang : How to login and logout with JWT example
+36.3k Golang : Convert(cast) int64 to string
+7.8k Golang : Load DSA public key from file example