A Go library for cropping images by removing borders with specified color.
Find a file
2017-06-30 22:14:04 +05:00
examples Rename examples dir 2017-06-25 17:01:04 +05:00
testimages Test rework, bugfixes and more tests 2017-06-26 23:12:48 +05:00
.gitignore Initial commit 2017-06-23 19:14:52 +05:00
.travis.yml Trying to connect Travis CI 2017-06-30 21:58:53 +05:00
colorconversion.go Test rework, bugfixes and more tests 2017-06-26 23:12:48 +05:00
colorconverson_test.go Test rework, bugfixes and more tests 2017-06-26 23:12:48 +05:00
colorcrop.go Comparator rework and fixes 2017-06-25 16:52:58 +05:00
colorcrop_test.go Test rework, bugfixes and more tests 2017-06-26 23:12:48 +05:00
comparators.go Test rework, bugfixes and more tests 2017-06-26 23:12:48 +05:00
comparators_test.go Test rework, bugfixes and more tests 2017-06-26 23:12:48 +05:00
example_test.go Fix go vet errors 2017-06-28 09:02:16 +05:00
LICENSE Initial commit 2017-06-23 19:14:52 +05:00
README.md Add coverage bage 2017-06-30 22:14:04 +05:00

colorcrop

Build Status Coverage Status

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,                    // for source image
    color.RGBA{255, 255, 255, 255}, // crop white border
    0.5)                            // with 50% thresold

You may use custom comparator of colors:

croppedImage := colorcrop.CropWithComparator(
    sourceImage,                    // for source image
    color.RGBA{255, 255, 255, 255}, // crop white border
    0.5,                            // with 50% thresold
    colorcrop.CmpCIE76)             // using CIE76 standart for defining color difference

Examples

See in "examples".