mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure auto-rotation works with shrink-on-load #3352
Fixes regression in 0.31.0
This commit is contained in:
@@ -557,6 +557,7 @@ namespace sharp {
|
||||
VImage RemoveExifOrientation(VImage image) {
|
||||
VImage copy = image.copy();
|
||||
copy.remove(VIPS_META_ORIENTATION);
|
||||
copy.remove("exif-ifd0-Orientation");
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,10 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
}
|
||||
|
||||
// Rotate pre-extract
|
||||
if (baton->rotateBeforePreExtract) {
|
||||
bool const shouldRotateBefore = baton->rotateBeforePreExtract &&
|
||||
(rotation != VIPS_ANGLE_D0 || flip || flop || baton->rotationAngle != 0.0);
|
||||
|
||||
if (shouldRotateBefore) {
|
||||
if (rotation != VIPS_ANGLE_D0) {
|
||||
image = image.rot(rotation);
|
||||
}
|
||||
@@ -167,7 +170,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
// - input colourspace is not specified;
|
||||
bool const shouldPreShrink = (targetResizeWidth > 0 || targetResizeHeight > 0) &&
|
||||
baton->gamma == 0 && baton->topOffsetPre == -1 && baton->trimThreshold == 0.0 &&
|
||||
baton->colourspaceInput == VIPS_INTERPRETATION_LAST;
|
||||
baton->colourspaceInput == VIPS_INTERPRETATION_LAST && !shouldRotateBefore;
|
||||
|
||||
if (shouldPreShrink) {
|
||||
// The common part of the shrink: the bit by which both axes must be shrunk
|
||||
|
||||
Reference in New Issue
Block a user