mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-15 02:15:54 -07:00
Adding basic smartcrop support.
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
parent
24d84e6d8c
commit
9c914467b3
7 changed files with 58 additions and 3 deletions
11
image.go
11
image.go
|
|
@ -41,6 +41,17 @@ func (i *Image) ResizeAndCrop(width, height int) ([]byte, error) {
|
|||
return i.Process(options)
|
||||
}
|
||||
|
||||
// SmartCrop produces a thumbnail aiming at focus on the interesting part.
|
||||
func (i *Image) SmartCrop(width, height int) ([]byte, error) {
|
||||
options := Options{
|
||||
Width: width,
|
||||
Height: height,
|
||||
Crop: true,
|
||||
SmartCrop: true,
|
||||
}
|
||||
return i.Process(options)
|
||||
}
|
||||
|
||||
// Extract area from the by X/Y axis in the current image.
|
||||
func (i *Image) Extract(top, left, width, height int) ([]byte, error) {
|
||||
options := Options{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue