Golang image.Paletted.At, Bounds and ColorIndex functions example
package image
Golang image.Paletted.At, Bounds and ColorIndex functions example
package main
import (
"fmt"
"image"
"image/color"
)
func main() {
p := color.Palette{color.NRGBA{0xf0, 0xf0, 0xf0, 0xff}}
rect := image.Rect(0, 0, 100, 100)
paletted := image.NewPaletted(rect, p)
fmt.Println("At : ",paletted.At(10,10))
fmt.Println("Bounds : ", paletted.Bounds())
fmt.Println("ColorIndexAt : ", paletted.ColorIndexAt(10,10))
}
Output :
At : {240 240 240 255}
Bounds : (0,0)-(100,100)
ColorIndexAt : 0
References :
http://golang.org/pkg/image/#Paletted.At
Advertisement
Something interesting
Tutorials
+16.6k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+6.9k Golang : Decode XML data from RSS feed
+4.7k Fix Google Analytics Redundant Hostnames problem
+6.8k Unix/Linux : How to fix CentOS yum duplicate glibc or device-mapper-libs dependency error?
+8.5k Golang : How to check if input string is a word?
+15.3k nginx: [emerg] unknown directive "ssl"
+36.4k Golang : Convert date or time stamp from string to time.Time type
+6.3k Unix/Linux : Use netstat to find out IP addresses served by your website server
+18k Golang : How to log each HTTP request to your web server?
+5.8k Golang : Launching your executable inside a console under Linux
+11.2k Golang : How to pipe input data to executing child process?
+11.1k Golang : Read until certain character to break for loop