diff --git a/src/pipeline.cc b/src/pipeline.cc index 90b09df74..a426dfbb3 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -518,12 +518,14 @@ class PipelineWorker : public Napi::AsyncWorker { MultiPageUnsupported(nPages, "Affine"); std::vector background; std::tie(image, background) = sharp::ApplyAlpha(image, baton->affineBackground, shouldPremultiplyAlpha); + vips::VInterpolate interp = vips::VInterpolate::new_from_name( + const_cast(baton->affineInterpolator.data())); image = image.affine(baton->affineMatrix, VImage::option()->set("background", background) ->set("idx", baton->affineIdx) ->set("idy", baton->affineIdy) ->set("odx", baton->affineOdx) ->set("ody", baton->affineOdy) - ->set("interpolate", baton->affineInterpolator)); + ->set("interpolate", interp)); } // Extend edges @@ -1428,7 +1430,7 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) { baton->affineIdy = sharp::AttrAsDouble(options, "affineIdy"); baton->affineOdx = sharp::AttrAsDouble(options, "affineOdx"); baton->affineOdy = sharp::AttrAsDouble(options, "affineOdy"); - baton->affineInterpolator = vips::VInterpolate::new_from_name(sharp::AttrAsStr(options, "affineInterpolator").data()); + baton->affineInterpolator = sharp::AttrAsStr(options, "affineInterpolator"); baton->removeAlpha = sharp::AttrAsBool(options, "removeAlpha"); baton->ensureAlpha = sharp::AttrAsDouble(options, "ensureAlpha"); if (options.Has("boolean")) { diff --git a/src/pipeline.h b/src/pipeline.h index 0b27f5a9a..90e808d92 100644 --- a/src/pipeline.h +++ b/src/pipeline.h @@ -126,7 +126,7 @@ struct PipelineBaton { double affineIdy; double affineOdx; double affineOdy; - vips::VInterpolate affineInterpolator; + std::string affineInterpolator; int jpegQuality; bool jpegProgressive; std::string jpegChromaSubsampling; @@ -268,7 +268,7 @@ struct PipelineBaton { affineIdy(0), affineOdx(0), affineOdy(0), - affineInterpolator(vips::VInterpolate::new_from_name("bicubic")), + affineInterpolator("bicubic"), jpegQuality(80), jpegProgressive(false), jpegChromaSubsampling("4:2:0"),