diff --git a/lib/constructor.js b/lib/constructor.js index bdf107766..e5f946359 100644 --- a/lib/constructor.js +++ b/lib/constructor.js @@ -194,7 +194,6 @@ const Sharp = function (input, options) { canvas: 'crop', position: 0, resizeBackground: [0, 0, 0, 255], - useExifOrientation: false, angle: 0, rotationAngle: 0, rotationBackground: [0, 0, 0, 255], @@ -362,7 +361,6 @@ const Sharp = function (input, options) { } }; this.options.input = this._createInputDescriptor(input, options, { allowStream: true }); - this.options.useExifOrientation = !!this.options.input.autoOrient; return this; }; Object.setPrototypeOf(Sharp.prototype, stream.Duplex.prototype); diff --git a/lib/operation.js b/lib/operation.js index 9129261e5..507f14081 100644 --- a/lib/operation.js +++ b/lib/operation.js @@ -102,7 +102,7 @@ function rotate (angle, options) { * @returns {Sharp} */ function autoOrient () { - this.options.useExifOrientation = true; + this.options.input.autoOrient = true; return this; } diff --git a/lib/resize.js b/lib/resize.js index b33bb0173..6b321fbed 100644 --- a/lib/resize.js +++ b/lib/resize.js @@ -107,7 +107,7 @@ const mapFitToCanvas = { * @private */ function isRotationExpected (options) { - return (options.angle % 360) !== 0 || options.useExifOrientation === true || options.rotationAngle !== 0; + return (options.angle % 360) !== 0 || options.input.autoOrient === true || options.rotationAngle !== 0; } /** diff --git a/src/pipeline.cc b/src/pipeline.cc index eae463a65..d4b8f2c0b 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -63,7 +63,7 @@ class PipelineWorker : public Napi::AsyncWorker { bool autoFlip = false; bool autoFlop = false; - if (baton->useExifOrientation) { + if (baton->input->autoOrient) { // Rotate and flip image according to Exif orientation std::tie(autoRotation, autoFlip, autoFlop) = CalculateExifRotationAndFlip(sharp::ExifOrientation(image)); image = sharp::RemoveExifOrientation(image); @@ -1589,7 +1589,6 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) { baton->claheWidth = sharp::AttrAsUint32(options, "claheWidth"); baton->claheHeight = sharp::AttrAsUint32(options, "claheHeight"); baton->claheMaxSlope = sharp::AttrAsUint32(options, "claheMaxSlope"); - baton->useExifOrientation = sharp::AttrAsBool(options, "useExifOrientation"); baton->angle = sharp::AttrAsInt32(options, "angle"); baton->rotationAngle = sharp::AttrAsDouble(options, "rotationAngle"); baton->rotationBackground = sharp::AttrAsVectorOfDouble(options, "rotationBackground"); diff --git a/src/pipeline.h b/src/pipeline.h index 4610b809c..530da5b67 100644 --- a/src/pipeline.h +++ b/src/pipeline.h @@ -109,7 +109,6 @@ struct PipelineBaton { int claheWidth; int claheHeight; int claheMaxSlope; - bool useExifOrientation; int angle; double rotationAngle; std::vector rotationBackground; @@ -282,7 +281,6 @@ struct PipelineBaton { claheWidth(0), claheHeight(0), claheMaxSlope(3), - useExifOrientation(false), angle(0), rotationAngle(0.0), rotationBackground{ 0.0, 0.0, 0.0, 255.0 },