Ensure create has correct bit depth and colourspace #3139

This commit is contained in:
Lovell Fuller
2022-03-22 19:48:02 +00:00
parent b609df4b48
commit 1d36936954
6 changed files with 50 additions and 8 deletions

View File

@@ -375,12 +375,6 @@ namespace sharp {
VImage::option()->set("mean", descriptor->createNoiseMean)->set("sigma", descriptor->createNoiseSigma)));
}
image = image.bandjoin(bands);
image = image.cast(VipsBandFormat::VIPS_FORMAT_UCHAR);
if (channels < 3) {
image = image.colourspace(VIPS_INTERPRETATION_B_W);
} else {
image = image.colourspace(VIPS_INTERPRETATION_sRGB);
}
} else {
std::vector<double> background = {
descriptor->createBackground[0],
@@ -392,7 +386,8 @@ namespace sharp {
}
image = VImage::new_matrix(descriptor->createWidth, descriptor->createHeight).new_from_image(background);
}
image.get_image()->Type = VIPS_INTERPRETATION_sRGB;
image.get_image()->Type = image.guess_interpretation();
image = image.cast(VIPS_FORMAT_UCHAR);
imageType = ImageType::RAW;
} else {
// From filesystem