Ensure trim is no-op when it would reduce to nothing #3223

This commit is contained in:
Lovell Fuller
2022-07-08 21:06:58 +01:00
parent 6c2e2be41d
commit cbf741cac7
5 changed files with 29 additions and 3 deletions

View File

@@ -297,10 +297,10 @@ namespace sharp {
}
}
}
if (width == 0 || height == 0) {
throw VError("Unexpected error while trimming. Try to lower the tolerance");
if (width > 0 && height > 0) {
return image.extract_area(left, top, width, height);
}
return image.extract_area(left, top, width, height);
return image;
}
/*