mirror of
https://github.com/nxshock/colorcrop.git
synced 2025-07-02 00:23:44 +05:00
A Go library for cropping images by removing borders with specified color.
testimages | ||
.gitignore | ||
.travis.yml | ||
colorconversion.go | ||
colorconverson_test.go | ||
colorcrop.go | ||
colorcrop_test.go | ||
comparators.go | ||
comparators_test.go | ||
example_test.go | ||
LICENSE | ||
README.md |
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, // 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 here.