Golang ProgramsGolang Programs

How to blur an image in Golang?

package main
 
import (    
    "os"   
    "image"
    "image/jpeg"
    "code.google.com/p/graphics-go/graphics"
)
 
func main() {
    imagePath, _ := os.Open("pokeball.jpg")
    defer imagePath.Close()
    srcImage, _, _ := image.Decode(imagePath)
     
    dstImage := image.NewRGBA(srcImage.Bounds())
	// Blur Function 
    graphics.Blur(dstImage, srcImage, &graphics.BlurOptions{StdDev: 5.5})
    
    newImage, _ := os.Create("blur.jpg")
    defer newImage.Close()
    jpeg.Encode(newImage, dstImage, &jpeg.Options{jpeg.DefaultQuality}) 
}
C:\golang\codes>go run example.go

C:\golang\codes>