Ensure pipelineColourspace is applied to all inputs #2704

This commit is contained in:
Lovell Fuller
2021-07-14 19:22:31 +01:00
parent 3f6d9d6ee9
commit a9aa55c32d
3 changed files with 22 additions and 8 deletions

View File

@@ -282,4 +282,16 @@ namespace sharp {
return image.linear(a, b);
}
}
/*
* Ensure the image is in a given colourspace
*/
VImage EnsureColourspace(VImage image, VipsInterpretation colourspace) {
if (colourspace != VIPS_INTERPRETATION_LAST && image.interpretation() != colourspace) {
image = image.colourspace(colourspace,
VImage::option()->set("source_space", image.interpretation()));
}
return image;
}
} // namespace sharp