Adding trim operation.

Closes #22

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
Yoan Blanc 2017-09-12 10:36:34 -04:00
parent b35675c245
commit c1f2667c0f
No known key found for this signature in database
GPG key ID: 6058CF4574298812
8 changed files with 64 additions and 5 deletions

View file

@ -178,6 +178,13 @@ func (i *Image) Colourspace(c Interpretation) ([]byte, error) {
return i.Process(options)
}
// Trim removes the background from the picture. It can result in a 0x0 output
// if the image is all background.
func (i *Image) Trim() ([]byte, error) {
options := Options{Trim: true}
return i.Process(options)
}
// Process processes the image based on the given transformation options,
// talking with libvips bindings accordingly and returning the resultant
// image buffer.