Skip to content
/ bild Public
forked from anthonynsimon/bild

A collection of image processing algorithms in pure Go

License

Notifications You must be signed in to change notification settings

nilslice/bild

 
 

Repository files navigation

bild

bild logo

MIT License GoDoc Build Status Go Report Card

import "github.com/anthonynsimon/bild"

Simple image processing in Go with parallel processing support.

Package bild provides a collection of common image processing functions. The input images must implement the image.Image interface and the functions return an *image.RGBA.

The aim of this project is simplicity in use and development over high performance, but most algorithms are designed to be efficient and make use of parallelism when available. It is based on standard Go packages to reduce dependency use and development abstractions.

Install

bild requires Go version 1.4 or greater.

go get -u github.com/anthonynsimon/bild

Documentation

http://godoc.org/github.com/anthonynsimon/bild

Basic example:

package main

import "github.com/anthonynsimon/bild"

func main() {
	img, err := bild.Open("filename")
	if err != nil {
		panic(err)
	}

	result := bild.Invert(img)

	if err := bild.Save("filename", result, bild.PNG); err != nil {
		panic(err)
	}
}

Output examples

Adjustment

Brightness

result := bild.Brightness(img, 0.25)

example

Contrast

result := bild.Contrast(img, -0.5)

example

Gamma

result := bild.Gamma(img, 2.2)

example

Blend modes

Add

result := bild.Add(bg, fg)

example

ColorBurn

result := bild.ColorBurn(bg, fg)

example

ColorDodge

result := bild.ColorDodge(bg, fg)

example

Darken

result := bild.Darken(bg, fg)

example

Difference

result := bild.Difference(bg, fg)

example

Divide

result := bild.Divide(bg, fg)

example

Exclusion

result := bild.Exclusion(bg, fg)

example

Lighten

result := bild.Lighten(bg, fg)

example

LinearBurn

result := bild.LinearBurn(bg, fg)

example

LinearLight

result := bild.LinearLight(bg, fg)

example

Multiply

result := bild.Multiply(bg, fg)

example

Normal

result := bild.Normal(bg, fg)

example

Opacity

result := bild.Opacity(bg, fg, 0.5)

example

Overlay

result := bild.Overlay(bg, fg)

example

Screen

result := bild.Screen(bg, fg)

example

SoftLight

result := bild.SoftLight(bg, fg)

example

Subtract

result := bild.Subtract(bg, fg)

example

Blur

BoxBlur

result := bild.BoxBlur(img, 3.0)

example

GaussianBlur

result := bild.GaussianBlur(img, 3.0)

example

Effects

EdgeDetection

result := bild.EdgeDetection(img, 1.0)

example

Emboss

result := bild.Emboss(img)

example

Grayscale

result := bild.Grayscale(img)

example

Invert

result := bild.Invert(img)

example

Median

result := bild.Median(img, 10.0)

example

Sharpen

result := bild.Sharpen(img)

example

Sobel

result := bild.Sobel(img)

example

Resize

Nearest Neighbor

result := bild.Resize(img, newWidth, newHeight, bild.NearestNeighbor)

example

Box Interpolation

result := bild.Resize(img, newWidth, newHeight, bild.Box)

example

Linear Interpolation

result := bild.Resize(img, newWidth, newHeight, bild.Linear)

example

Transform

FlipH

result := bild.FlipH(img)

example

FlipV

result := bild.FlipV(img)

example

License

This project is licensed under the MIT license. Please read the LICENSE file.

Contribute

Want to hack on the project? Any kind of contribution is welcome!
Simply follow the next steps:

  • Fork the project.
  • Create a new branch.
  • Make your changes and write tests when practical.
  • Commit your changes to the new branch.
  • Send a pull request, by the way you are awesome.

About

A collection of image processing algorithms in pure Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%