Ensure TIFF is cast when using float predictor (#2502)

This commit is contained in:
Randy Ridge
2020-12-29 09:29:51 -05:00
committed by Lovell Fuller
parent 98349bde28
commit 0bb8cb9203
3 changed files with 10 additions and 2 deletions

View File

@@ -955,6 +955,10 @@ class PipelineWorker : public Napi::AsyncWorker {
sharp::AssertImageTypeDimensions(image, sharp::ImageType::JPEG);
baton->channels = std::min(baton->channels, 3);
}
// Cast pixel values to float, if required
if (baton->tiffPredictor == VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT) {
image = image.cast(VIPS_FORMAT_FLOAT);
}
image.tiffsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
->set("strip", !baton->withMetadata)
->set("Q", baton->tiffQuality)