Skip to content

Commit d9a2a04

Browse files
authored
find_trim: fix a crash when enabling line_art mode (libvips#3630)
1 parent 52f9efa commit d9a2a04

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

libvips/arithmetic/find_trim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ vips_find_trim_build(VipsObject *object)
127127
if (!find_trim->line_art) {
128128
if (vips_median(in, &t[1], 3, NULL))
129129
return -1;
130+
in = t[1];
130131
}
131-
in = t[1];
132132

133133
/* Smooth, find difference from bg, abs, threshold.
134134
*/

test/test-suite/test_arithmetic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,8 @@ def test_find_trim(self):
696696
assert height == 60
697697

698698
test_rgb = test.bandjoin([test, test])
699-
left, top, width, height = test_rgb.find_trim(background=[255, 255,
699+
left, top, width, height = test_rgb.find_trim(line_art=True,
700+
background=[255, 255,
700701
255])
701702
assert left == 10
702703
assert top == 20

0 commit comments

Comments
 (0)