Golang image.NewAlpha16 function example
package image
func NewAlpha16(r Rectangle) *Alpha16
NewAlpha16 returns a new Alpha16 with the given bounds.
Golang image.NewAlpha16 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)
fmt.Println(img.At(10, 10))
bounds := img.Bounds()
fmt.Println(bounds)
canvas := image.NewAlpha16(bounds) // <-- here
// is this image opaque
op := canvas.Opaque()
fmt.Println(op)
}
Reference :
Advertisement
Something interesting
Tutorials
+10.9k Golang : Create Temporary File
+8.8k Golang : HTTP Routing with Goji example
+23.5k Golang : Check if element exist in map
+7.8k Golang : Load DSA public key from file example
+5.6k Python : Print unicode escape characters and string
+21.8k Golang : Convert string slice to struct and access with reflect example
+5.1k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version
+9.9k Golang : Function wrapper that takes arguments and return result example
+11.6k Golang : Concurrency and goroutine example
+5.2k Golang : The Tao of importing package
+5.4k Gogland : Datasource explorer