mirror of
https://github.com/lovell/sharp.git
synced 2026-02-04 21:56:18 +01:00
Add greyscale option to threshold operation (#480)
This commit is contained in:
committed by
Lovell Fuller
parent
4b98dbb454
commit
85f20c6e1b
@@ -327,4 +327,11 @@ namespace sharp {
|
||||
);
|
||||
}
|
||||
|
||||
VImage Threshold(VImage image, double const threshold, bool const thresholdGrayscale) {
|
||||
if(!thresholdGrayscale) {
|
||||
return image >= threshold;
|
||||
}
|
||||
return image.colourspace(VIPS_INTERPRETATION_B_W) >= threshold;
|
||||
}
|
||||
|
||||
} // namespace sharp
|
||||
|
||||
Reference in New Issue
Block a user