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

@ -457,8 +457,8 @@ func TestFluentInterface(t *testing.T) {
func TestImageSmartCrop(t *testing.T) {
if !(VipsMajorVersion >= 8 && VipsMinorVersion > 4) {
t.Skipf("Skipping this test, libvips doesn't meet version requirement %s > 8.4", VipsVersion)
if !(VipsMajorVersion >= 8 && VipsMinorVersion >= 5) {
t.Skipf("Skipping this test, libvips doesn't meet version requirement %s >= 8.5", VipsVersion)
}
i := initImage("northern_cardinal_bird.jpg")
@ -475,6 +475,26 @@ func TestImageSmartCrop(t *testing.T) {
Write("fixtures/test_smart_crop.jpg", buf)
}
func TestImageTrim(t *testing.T) {
if !(VipsMajorVersion >= 8 && VipsMinorVersion >= 6) {
t.Skipf("Skipping this test, libvips doesn't meet version requirement %s >= 8.6", VipsVersion)
}
i := initImage("transparent.png")
buf, err := i.Trim()
if err != nil {
t.Errorf("Cannot process the image: %#v", err)
}
err = assertSize(buf, 250, 208)
if err != nil {
t.Errorf("The image wasn't trimmed.")
}
Write("fixtures/transparent_trim.png", buf)
}
func TestImageLength(t *testing.T) {
i := initImage("test.jpg")