Ensure op ordering is respected where possible #3319

Emit warnings when previous ops might be ignored
Flip and flop now occur before rotate, if any
This commit is contained in:
Lovell Fuller
2022-08-18 13:57:13 +01:00
parent e547eaa180
commit 212a6e7519
13 changed files with 168 additions and 50 deletions

View File

@@ -387,6 +387,18 @@ class PipelineWorker : public Napi::AsyncWorker {
->set("kernel", kernel));
}
// Flip (mirror about Y axis)
if (baton->flip || flip) {
image = image.flip(VIPS_DIRECTION_VERTICAL);
image = sharp::RemoveExifOrientation(image);
}
// Flop (mirror about X axis)
if (baton->flop || flop) {
image = image.flip(VIPS_DIRECTION_HORIZONTAL);
image = sharp::RemoveExifOrientation(image);
}
// Rotate post-extract 90-angle
if (!baton->rotateBeforePreExtract && rotation != VIPS_ANGLE_D0) {
image = image.rot(rotation);
@@ -401,18 +413,6 @@ class PipelineWorker : public Napi::AsyncWorker {
image = sharp::RemoveExifOrientation(image);
}
// Flip (mirror about Y axis)
if (baton->flip || flip) {
image = image.flip(VIPS_DIRECTION_VERTICAL);
image = sharp::RemoveExifOrientation(image);
}
// Flop (mirror about X axis)
if (baton->flop || flop) {
image = image.flip(VIPS_DIRECTION_HORIZONTAL);
image = sharp::RemoveExifOrientation(image);
}
// Join additional color channels to the image
if (baton->joinChannelIn.size() > 0) {
VImage joinImage;