mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
Add the option to use background and threshold options on trim
This commit is contained in:
parent
1a5477aae5
commit
58bc9312b6
5 changed files with 42 additions and 5 deletions
|
|
@ -495,6 +495,31 @@ func TestImageTrim(t *testing.T) {
|
|||
Write("testdata/transparent_trim.png", buf)
|
||||
}
|
||||
|
||||
func TestImageTrimParameters(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("test.png")
|
||||
options := Options{
|
||||
Trim: true,
|
||||
Background: Color{0.0, 0.0, 0.0},
|
||||
Threshold: 10.0,
|
||||
}
|
||||
buf, err := i.Process(options)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
|
||||
err = assertSize(buf, 400, 257)
|
||||
if err != nil {
|
||||
t.Errorf("The image wasn't trimmed.")
|
||||
}
|
||||
|
||||
Write("testdata/transparent_trim.png", buf)
|
||||
}
|
||||
|
||||
func TestImageLength(t *testing.T) {
|
||||
i := initImage("test.jpg")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue