A Go library for cropping images by removing borders with specified color.
Find a file
2017-06-25 16:52:58 +05:00
example Upload code 2017-06-23 19:18:15 +05:00
.gitignore Initial commit 2017-06-23 19:14:52 +05:00
colorconversion.go Comparator rework and fixes 2017-06-25 16:52:58 +05:00
colorcrop.go Comparator rework and fixes 2017-06-25 16:52:58 +05:00
comparators.go Comparator rework and fixes 2017-06-25 16:52:58 +05:00
comparators_test.go Comparator rework and fixes 2017-06-25 16:52:58 +05:00
example_test.go Upload code 2017-06-23 19:18:15 +05:00
LICENSE Initial commit 2017-06-23 19:14:52 +05:00
README.md Comparator rework and fixes 2017-06-25 16:52:58 +05:00

colorcrop

A pure Go library for cropping images by removing borders with specified color.

Installation

go get -u github.com/nxshock/colorcrop

Usage

Import package with

import "github.com/nxshock/colorcrop"

Crop white borders with 50% of thresold:

croppedImage := colorcrop.Crop(sourceImage, color.RGBA{255, 255, 255, 255}, 0.5)

You may use custom comparator of colors:

croppedImage := colorcrop.CropWithComparator(sourceImage, color.RGBA{255, 255, 255, 255}, 0.5, colorcrop.CmpCIE76)

Examples

See in "examples".