Drop options.useExifOrientation in favor of options.input.autoOrient

This commit is contained in:
Don Denton 2024-07-14 00:04:36 -04:00
parent 8e7c7b4196
commit 7169a2555e
5 changed files with 3 additions and 8 deletions

View File

@ -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);

View File

@ -102,7 +102,7 @@ function rotate (angle, options) {
* @returns {Sharp}
*/
function autoOrient () {
this.options.useExifOrientation = true;
this.options.input.autoOrient = true;
return this;
}

View File

@ -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;
}
/**

View File

@ -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");

View File

@ -109,7 +109,6 @@ struct PipelineBaton {
int claheWidth;
int claheHeight;
int claheMaxSlope;
bool useExifOrientation;
int angle;
double rotationAngle;
std::vector<double> 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 },