/go-filters

📚 Image filters library written in Go

Primary LanguageGo

go-filters 🖼️

This is a simple go project that applies different filters like grayscale or B&W to an image.

Usage

There are several filters you can apply to an image. Here is a start.

The grayscale filter using the weighted coefficients

$ go run main.go ./examples/winxp.png grayscale-coeff

The grayscale filter using the average value of the three channels ((R)ed, (G)reen and (B)lue)

$ go run main.go ./examples/winxp.png grayscale-avg

The black&white filter

$ go run main.go ./examples/winxp.png bw

Filters

  • Grayscales

    • averaging the RGB components
    • weighted sum of the RGB components Y = 0.299 * R + 0.587 * G + 0.114 * B
  • Black & White

Examples

Original image

Grayscale using the weighted sum method

Grayscale using the averaging method

Black & White filter

Resources