Ensure negate op occurs after profile conversion (#4096)

- Adds CMYK to CMYK profile conversion tests
- Fixes existing greyscale plus alpha test expectation
This commit is contained in:
Adriaan Meuris
2024-05-13 13:23:11 +02:00
committed by GitHub
parent b5fddd7c5e
commit 29336f4cc7
7 changed files with 44 additions and 5 deletions

View File

@@ -357,11 +357,6 @@ class PipelineWorker : public Napi::AsyncWorker {
image = sharp::Flatten(image, baton->flattenBackground);
}
// Negate the colours in the image
if (baton->negate) {
image = sharp::Negate(image, baton->negateAlpha);
}
// Gamma encoding (darken)
if (baton->gamma >= 1 && baton->gamma <= 3) {
image = sharp::Gamma(image, 1.0 / baton->gamma);
@@ -821,6 +816,12 @@ class PipelineWorker : public Napi::AsyncWorker {
} else if (baton->keepMetadata & VIPS_FOREIGN_KEEP_ICC) {
image = sharp::SetProfile(image, inputProfile);
}
// Negate the colours in the image
if (baton->negate) {
image = sharp::Negate(image, baton->negateAlpha);
}
// Override EXIF Orientation tag
if (baton->withMetadataOrientation != -1) {
image = sharp::SetExifOrientation(image, baton->withMetadataOrientation);