Adding basic smartcrop support.

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
Yoan Blanc 2017-04-04 10:17:01 +02:00
parent 24d84e6d8c
commit 9c914467b3
No known key found for this signature in database
GPG key ID: 6058CF4574298812
7 changed files with 58 additions and 3 deletions

View file

@ -455,6 +455,23 @@ func TestFluentInterface(t *testing.T) {
Write("fixtures/test_image_fluent_out.png", image.Image())
}
func TestImageSmartCrop(t *testing.T) {
if VipsMajorVersion >= 8 && VipsMinorVersion > 4 {
i := initImage("northern_cardinal_bird.jpg")
buf, err := i.SmartCrop(300, 300)
if err != nil {
t.Errorf("Cannot process the image: %#v", err)
}
err = assertSize(buf, 300, 300)
if err != nil {
t.Error(err)
}
Write("fixtures/test_smart_crop.jpg", buf)
}
}
func initImage(file string) *Image {
buf, _ := imageBuf(file)
return NewImage(buf)