From 6b5251a7816375229df9bc93390f45ae5823b998 Mon Sep 17 00:00:00 2001 From: nxshock Date: Sat, 15 Jul 2017 11:44:10 +0500 Subject: [PATCH] README now in RST format --- README.md | 47 ---------------------------------------------- README.rst | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 47 deletions(-) delete mode 100644 README.md create mode 100644 README.rst diff --git a/README.md b/README.md deleted file mode 100644 index 45d08ae..0000000 --- a/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# colorcrop - -[![Build Status](https://travis-ci.org/nxshock/colorcrop.svg?branch=master)](https://travis-ci.org/nxshock/colorcrop) -[![Coverage Status](https://coveralls.io/repos/github/nxshock/colorcrop/badge.svg)](https://coveralls.io/github/nxshock/colorcrop) -[![GoDoc](https://godoc.org/github.com/nxshock/colorcrop?status.svg)](https://godoc.org/github.com/nxshock/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, // for source image - color.RGBA{255, 255, 255, 255}, // crop white border - 0.5) // with 50% thresold -``` - -You may use custom comparator of colors: - -```go -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 -``` - -Available comparators are: -- `CmpRGBComponents` - simple RGB components difference: `abs(r1-r2)+abs(g1-g2)+abs(b1-b2)` (default); -- `CmpEuclidean` - [Euclidean difference](https://en.wikipedia.org/wiki/Color_difference#Euclidean); -- `CmpCIE76` - difference of two colors defined in [CIE76 standart](https://en.wikipedia.org/wiki/Color_difference#CIE76). - -## Examples - -See [here](https://github.com/nxshock/colorcrop/blob/master/example_test.go). diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..c9a50a0 --- /dev/null +++ b/README.rst @@ -0,0 +1,55 @@ +colorcrop +========= + +.. image:: https://travis-ci.org/nxshock/colorcrop.svg?branch=master + :alt: Build Status +.. image:: https://coveralls.io/repos/github/nxshock/colorcrop/badge.svg + :alt: Coverage Status +.. image:: https://godoc.org/github.com/nxshock/colorcrop?status.svg + :alt: GoDoc + +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: + +.. code:: go + + import "github.com/nxshock/colorcrop" + +Crop white borders with 50% of thresold: + +.. code:: go + + 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: + +.. code:: go + + 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 + +Available comparators are: + +* ``CmpRGBComponents`` -- simple RGB components difference: ``abs(r1-r2)+abs(g1-g2)+abs(b1-b2)`` (default); +* ``CmpEuclidean`` -- `Euclidean difference `_; +* ``CmpCIE76`` -- difference of two colors defined in `CIE76 standard `_. + +Examples +-------- + +See `here `_.