mirror of
https://github.com/nxshock/colorcrop.git
synced 2025-07-02 00:23:44 +05:00
31 lines
575 B
Markdown
31 lines
575 B
Markdown
# 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
|
|
|
|
```go
|
|
import "github.com/nxshock/colorcrop"
|
|
```
|
|
|
|
Crop **white** borders with **50%** of thresold:
|
|
|
|
```go
|
|
croppedImage := colorcrop.Crop(sourceImage, color.RGBA{255, 255, 255, 255}, 0.5)
|
|
```
|
|
|
|
You may use custom comparator of colors:
|
|
|
|
```go
|
|
croppedImage := colorcrop.CropWithComparator(sourceImage, color.RGBA{255, 255, 255, 255}, 0.5, colorcrop.CmpCIE76)
|
|
```
|
|
|
|
## Examples
|
|
|
|
See in "examples".
|