Skip to content

Commit

Permalink
find_trim: fix a crash when enabling line_art mode (libvips#3630)
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke authored Sep 10, 2023
1 parent 52f9efa commit d9a2a04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libvips/arithmetic/find_trim.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ vips_find_trim_build(VipsObject *object)
if (!find_trim->line_art) {
if (vips_median(in, &t[1], 3, NULL))
return -1;
in = t[1];
}
in = t[1];

/* Smooth, find difference from bg, abs, threshold.
*/
Expand Down
3 changes: 2 additions & 1 deletion test/test-suite/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ def test_find_trim(self):
assert height == 60

test_rgb = test.bandjoin([test, test])
left, top, width, height = test_rgb.find_trim(background=[255, 255,
left, top, width, height = test_rgb.find_trim(line_art=True,
background=[255, 255,
255])
assert left == 10
assert top == 20
Expand Down

0 comments on commit d9a2a04

Please sign in to comment.