Skip to content
A fast almost Gaussian Blur implementation in Go
Go
Branch: master
Clone or download
Latest commit fff1ca4 Jul 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd Use gif output destination relative to the output destintation Jan 21, 2019
image Readd sample images Mar 1, 2018
.gitignore Modify .gitignore Jan 18, 2019
.travis.yml Include travis Jan 21, 2019
LICENSE Include .gitignore Mar 1, 2018
README.md Include godoc badge Jul 12, 2019
doc.go include documentation Jul 12, 2019
stackblur.go Comments code Jan 21, 2019

README.md

stackblur-go

GoDoc Build Status

This is a Go port of Stackblur algorithm created by Mario Klingemann.

Stackblur is a compromise between Gaussian blur and Box blur, but it creates much better looking blurs than Box blur and it is ~7x faster than Gaussian blur.

Comparing to the Javascript implementation the Go version is at least 50% faster (depending on the image size and blur radius), running the same image with the same bluring radius.

Benchmark

Radius Javascript Go
20 ~15ms ~7.4ms

Installation

First, install Go, set your GOPATH, and make sure $GOPATH/bin is on your PATH.

$ export GOPATH="$HOME/go"
$ export PATH="$PATH:$GOPATH/bin"

Next build the binary file.

$ go get -u github.com/esimov/stackblur-go/cmd

CLI example

The provided CLI example supports the following flags:

$ stackblur --help

Usage of stackblur:
  -gif
    	Output Gif
  -in string
    	Source
  -out string
    	Destination
  -radius int
    	Radius (default 20)

The command below will generate the blurred version of the source image.

$ stackblur -in image/sample.png -out image/output.png -radius 10

The cli command supports a -gif flag, which if set as true it visualize the bluring process by outputting the result into a gif file.

API call

The API is very simple: you have to expose an image file and a blur radius to the Process function.

stackblur.Process(src, blurRadius)

Results

Original image Blured image

License

This project is under the MIT License. See the LICENSE file for the full license text.

You can’t perform that action at this time.