Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(canvas): levels, hue, and invert adjustment entries
Josh Corbett85a6b56d5670
diff --git a/invokeai/frontend/webv2/performance/architecture-baseline.json b/invokeai/frontend/webv2/performance/architecture-baseline.jsonindex 4c3f9d61ae..222b91b153 100644--- a/invokeai/frontend/webv2/performance/architecture-baseline.json+++ b/invokeai/frontend/webv2/performance/architecture-baseline.json@@ -2,15 +2,15 @@"build": {"launchpad": {"baseline": {- "brotliBytes": 841126,+ "brotliBytes": 841562,"cssRawBytes": 2159,"fontRawBytes": 219480,- "gzipBytes": 840009,+ "gzipBytes": 840523,"imageRawBytes": 156376,- "initialRawBytes": 1958397,+ "initialRawBytes": 1959074,"largestAssetRawBytes": 746376,"otherAssetRawBytes": 0,- "ownedRawBytes": 70895,+ "ownedRawBytes": 70904,"requestCount": 42,"scriptRequestCount": 26,"sourceOwners": [@@ -291,15 +291,15 @@]},"limits": {- "brotliBytes": 849538,+ "brotliBytes": 849978,"cssRawBytes": 2181,"fontRawBytes": 221675,- "gzipBytes": 848410,+ "gzipBytes": 848929,"imageRawBytes": 157940,- "initialRawBytes": 1977981,+ "initialRawBytes": 1978665,"largestAssetRawBytes": 753840,"otherAssetRawBytes": 0,- "ownedRawBytes": 70895,+ "ownedRawBytes": 70904,"requestCount": 42,"scriptRequestCount": 26},@@ -309,15 +309,15 @@},"editor": {"baseline": {- "brotliBytes": 1100278,+ "brotliBytes": 1102073,"cssRawBytes": 2159,"fontRawBytes": 219480,- "gzipBytes": 1095705,+ "gzipBytes": 1097661,"imageRawBytes": 156376,- "initialRawBytes": 2745741,+ "initialRawBytes": 2749227,"largestAssetRawBytes": 746376,"otherAssetRawBytes": 0,- "ownedRawBytes": 114602,+ "ownedRawBytes": 114618,"requestCount": 97,"scriptRequestCount": 81,"sourceOwners": [@@ -933,15 +933,15 @@]},"limits": {- "brotliBytes": 1111281,+ "brotliBytes": 1113094,"cssRawBytes": 2181,"fontRawBytes": 221675,- "gzipBytes": 1106663,+ "gzipBytes": 1108638,"imageRawBytes": 157940,- "initialRawBytes": 2773199,+ "initialRawBytes": 2776720,"largestAssetRawBytes": 753840,"otherAssetRawBytes": 0,- "ownedRawBytes": 114602,+ "ownedRawBytes": 114618,"requestCount": 97,"scriptRequestCount": 81},diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.jsonindex b86a79e75a..bb5910c20b 100644--- a/invokeai/frontend/webv2/performance/browser-baseline.json+++ b/invokeai/frontend/webv2/performance/browser-baseline.json@@ -25,13 +25,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 120.69999999552965,+ "domContentLoadedMedianMs": 121.5,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 120.79999999701977,- "longestTaskMaxMs": 72,+ "loadMedianMs": 121.60000000149012,+ "longestTaskMaxMs": 75,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -41,24 +41,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 38,- "scriptRawBytes": 1634420,+ "scriptRawBytes": 1635101,"scriptRequestCount": 34,- "totalRawBytes": 1818916+ "totalRawBytes": 1820093},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 38,- "scriptRawBytes": 1650765,+ "scriptRawBytes": 1651453,"scriptRequestCount": 34,- "totalRawBytes": 1837106+ "totalRawBytes": 1838294},- "routeReadyMedianMs": 266.8999999985099,+ "routeReadyMedianMs": 279.90000000596046,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "empty"},@@ -85,13 +85,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 128.30000000447035,+ "domContentLoadedMedianMs": 123.89999999850988,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 128.5,- "longestTaskMaxMs": 76,+ "loadMedianMs": 124,+ "longestTaskMaxMs": 72,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -101,24 +101,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 38,- "scriptRawBytes": 1634420,+ "scriptRawBytes": 1635101,"scriptRequestCount": 34,- "totalRawBytes": 1818916+ "totalRawBytes": 1820093},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 38,- "scriptRawBytes": 1650765,+ "scriptRawBytes": 1651453,"scriptRequestCount": 34,- "totalRawBytes": 1837106+ "totalRawBytes": 1838294},- "routeReadyMedianMs": 298,+ "routeReadyMedianMs": 295.6000000014901,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "representative"},@@ -145,15 +145,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 125,+ "domContentLoadedMedianMs": 123.5,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 125.10000000149012,- "longestTaskMaxMs": 108,+ "loadMedianMs": 123.70000000298023,+ "longestTaskMaxMs": 102,"owner": "workbench",- "projectSwitchMedianMs": 40.600000001490116,+ "projectSwitchMedianMs": 44,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -161,24 +161,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 115,- "scriptRawBytes": 3268726,+ "scriptRawBytes": 3271292,"scriptRequestCount": 110,- "totalRawBytes": 3609598+ "totalRawBytes": 3612660},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 115,- "scriptRawBytes": 3301414,+ "scriptRawBytes": 3304005,"scriptRequestCount": 110,- "totalRawBytes": 3645694+ "totalRawBytes": 3648787},- "routeReadyMedianMs": 692.8000000044703,+ "routeReadyMedianMs": 690.3999999985099,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -205,13 +205,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 122.70000000298023,+ "domContentLoadedMedianMs": 123.60000000149012,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 122.80000000447035,- "longestTaskMaxMs": 197,+ "loadMedianMs": 123.69999999552965,+ "longestTaskMaxMs": 200,"owner": "workbench","projectSwitchMedianMs": 82,"readyMark": "invokeai:ready:widget:center:preview",@@ -221,24 +221,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 115,- "scriptRawBytes": 3268726,+ "scriptRawBytes": 3271292,"scriptRequestCount": 110,- "totalRawBytes": 3609598+ "totalRawBytes": 3612660},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 115,- "scriptRawBytes": 3301414,+ "scriptRawBytes": 3304005,"scriptRequestCount": 110,- "totalRawBytes": 3645694+ "totalRawBytes": 3648787},- "routeReadyMedianMs": 476.30000000447035,+ "routeReadyMedianMs": 476.8999999985099,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"},@@ -247,31 +247,31 @@"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 277476,+ "largestAssetRawBytes": 283464,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 435128,+ "scriptRawBytes": 441717,"scriptRequestCount": 7,- "totalRawBytes": 435128+ "totalRawBytes": 441717},"activatedResourceLimits": {"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 280251,+ "largestAssetRawBytes": 286299,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 439480,+ "scriptRawBytes": 446135,"scriptRequestCount": 7,- "totalRawBytes": 439480+ "totalRawBytes": 446135},- "domContentLoadedMedianMs": 124.20000000298023,+ "domContentLoadedMedianMs": 123.19999999552965,"id": "editor-canvas",- "layoutAckMedianMs": 2.5,- "layoutReturnSwitchMedianMs": 57,- "layoutSwitchMedianMs": 89.39999999850988,- "loadMedianMs": 124.30000000447035,- "longestTaskMaxMs": 133,+ "layoutAckMedianMs": 2.2999999970197678,+ "layoutReturnSwitchMedianMs": 58.400000005960464,+ "layoutSwitchMedianMs": 98,+ "loadMedianMs": 123.19999999552965,+ "longestTaskMaxMs": 137,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -281,24 +281,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 122,- "scriptRawBytes": 3703854,+ "scriptRawBytes": 3713009,"scriptRequestCount": 117,- "totalRawBytes": 4044726+ "totalRawBytes": 4054377},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 122,- "scriptRawBytes": 3740893,+ "scriptRawBytes": 3750140,"scriptRequestCount": 117,- "totalRawBytes": 4085174+ "totalRawBytes": 4094921},- "routeReadyMedianMs": 1068.8999999985099,+ "routeReadyMedianMs": 1080.2000000029802,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "empty"},@@ -307,31 +307,31 @@"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 277476,+ "largestAssetRawBytes": 283464,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 435128,+ "scriptRawBytes": 441717,"scriptRequestCount": 7,- "totalRawBytes": 435128+ "totalRawBytes": 441717},"activatedResourceLimits": {"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 280251,+ "largestAssetRawBytes": 286299,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 439480,+ "scriptRawBytes": 446135,"scriptRequestCount": 7,- "totalRawBytes": 439480+ "totalRawBytes": 446135},- "domContentLoadedMedianMs": 122.20000000298023,+ "domContentLoadedMedianMs": 127.29999999701977,"id": "editor-canvas","layoutAckMedianMs": 3.2000000029802322,- "layoutReturnSwitchMedianMs": 48.80000000447035,- "layoutSwitchMedianMs": 90,- "loadMedianMs": 122.5,- "longestTaskMaxMs": 197,+ "layoutReturnSwitchMedianMs": 49.20000000298023,+ "layoutSwitchMedianMs": 101.80000000447035,+ "loadMedianMs": 127.5,+ "longestTaskMaxMs": 198,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -341,24 +341,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 122,- "scriptRawBytes": 3703854,+ "scriptRawBytes": 3713009,"scriptRequestCount": 117,- "totalRawBytes": 4044726+ "totalRawBytes": 4054377},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 122,- "scriptRawBytes": 3740893,+ "scriptRawBytes": 3750140,"scriptRequestCount": 117,- "totalRawBytes": 4085174+ "totalRawBytes": 4094921},- "routeReadyMedianMs": 1210.6999999955297,+ "routeReadyMedianMs": 1228.3000000044703,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "representative"},@@ -370,9 +370,9 @@"largestAssetRawBytes": 173980,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 364237,+ "scriptRawBytes": 364251,"scriptRequestCount": 6,- "totalRawBytes": 379650+ "totalRawBytes": 379664},"activatedResourceLimits": {"cssRawBytes": 15568,@@ -381,17 +381,17 @@"largestAssetRawBytes": 175720,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 367880,+ "scriptRawBytes": 367894,"scriptRequestCount": 6,- "totalRawBytes": 383447+ "totalRawBytes": 383461},- "domContentLoadedMedianMs": 125.60000000149012,+ "domContentLoadedMedianMs": 124.5,"id": "editor-workflow","layoutAckMedianMs": 2.600000001490116,- "layoutReturnSwitchMedianMs": 37,- "layoutSwitchMedianMs": 85.19999999552965,- "loadMedianMs": 125.79999999701977,- "longestTaskMaxMs": 108,+ "layoutReturnSwitchMedianMs": 35.70000000298023,+ "layoutSwitchMedianMs": 97.79999999701977,+ "loadMedianMs": 124.69999999552965,+ "longestTaskMaxMs": 107,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -401,24 +401,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 122,- "scriptRawBytes": 3632963,+ "scriptRawBytes": 3635543,"scriptRequestCount": 116,- "totalRawBytes": 3989248+ "totalRawBytes": 3992324},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 122,- "scriptRawBytes": 3669293,+ "scriptRawBytes": 3671899,"scriptRequestCount": 116,- "totalRawBytes": 4029141+ "totalRawBytes": 4032248},- "routeReadyMedianMs": 1074,+ "routeReadyMedianMs": 1093.7000000029802,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "empty"},@@ -430,9 +430,9 @@"largestAssetRawBytes": 173980,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 364237,+ "scriptRawBytes": 364251,"scriptRequestCount": 6,- "totalRawBytes": 379650+ "totalRawBytes": 379664},"activatedResourceLimits": {"cssRawBytes": 15568,@@ -441,17 +441,17 @@"largestAssetRawBytes": 175720,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 367880,+ "scriptRawBytes": 367894,"scriptRequestCount": 6,- "totalRawBytes": 383447+ "totalRawBytes": 383461},- "domContentLoadedMedianMs": 122.69999999552965,+ "domContentLoadedMedianMs": 126,"id": "editor-workflow",- "layoutAckMedianMs": 2.7999999970197678,- "layoutReturnSwitchMedianMs": 43.70000000298023,- "layoutSwitchMedianMs": 134.20000000298023,- "loadMedianMs": 122.69999999552965,- "longestTaskMaxMs": 390,+ "layoutAckMedianMs": 2.899999998509884,+ "layoutReturnSwitchMedianMs": 43.5,+ "layoutSwitchMedianMs": 137.39999999850988,+ "loadMedianMs": 126.19999999552965,+ "longestTaskMaxMs": 398,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -461,24 +461,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 122,- "scriptRawBytes": 3632963,+ "scriptRawBytes": 3635543,"scriptRequestCount": 116,- "totalRawBytes": 3989248+ "totalRawBytes": 3992324},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 122,- "scriptRawBytes": 3669293,+ "scriptRawBytes": 3671899,"scriptRequestCount": 116,- "totalRawBytes": 4029141+ "totalRawBytes": 4032248},- "routeReadyMedianMs": 1252.8999999985099,+ "routeReadyMedianMs": 1283.5,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "representative"},@@ -505,13 +505,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 123.79999999701977,+ "domContentLoadedMedianMs": 124.20000000298023,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 27.399999998509884,- "loadMedianMs": 124,- "longestTaskMaxMs": 108,+ "layoutSwitchMedianMs": 28,+ "loadMedianMs": 124.30000000447035,+ "longestTaskMaxMs": 112,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -521,24 +521,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 115,- "scriptRawBytes": 3268726,+ "scriptRawBytes": 3271292,"scriptRequestCount": 110,- "totalRawBytes": 3609598+ "totalRawBytes": 3612660},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 115,- "scriptRawBytes": 3301414,+ "scriptRawBytes": 3304005,"scriptRequestCount": 110,- "totalRawBytes": 3645694+ "totalRawBytes": 3648787},- "routeReadyMedianMs": 1299.6000000014901,+ "routeReadyMedianMs": 1293.7999999970198,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -565,13 +565,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 124.70000000298023,+ "domContentLoadedMedianMs": 125,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 97,- "loadMedianMs": 124.90000000596046,- "longestTaskMaxMs": 207,+ "layoutSwitchMedianMs": 100.80000000447035,+ "loadMedianMs": 125.20000000298023,+ "longestTaskMaxMs": 196,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -581,24 +581,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158673,+ "otherRawBytes": 159169,"requestCount": 115,- "scriptRawBytes": 3268726,+ "scriptRawBytes": 3271292,"scriptRequestCount": 110,- "totalRawBytes": 3609598+ "totalRawBytes": 3612660},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 160260,+ "otherRawBytes": 160761,"requestCount": 115,- "scriptRawBytes": 3301414,+ "scriptRawBytes": 3304005,"scriptRequestCount": 110,- "totalRawBytes": 3645694+ "totalRawBytes": 3648787},- "routeReadyMedianMs": 1517,+ "routeReadyMedianMs": 1513,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"}diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex 8411fc3125..07a172d085 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -2837,6 +2837,17 @@"contrast": "Contrast","curves": "Curves","curvesHint": "Drag points to bend the curve. Double-click empty space to add a point; double-click a point to remove it.",+ "levels": "Levels",+ "inputLevels": "Input levels",+ "inputBlack": "Input black point",+ "inputWhite": "Input white point",+ "gamma": "Gamma",+ "outputLevels": "Output levels",+ "outputBlack": "Output black point",+ "outputWhite": "Output white point",+ "hue": "Hue",+ "invert": "Invert",+ "invertHint": "Inverts the layer’s colors. This adjustment has no options.","saturation": "Saturation","transparencyLock": "Lock transparency"},diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/contracts.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/contracts.tsindex 0074068edd..f2541de588 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/contracts.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/contracts.ts@@ -174,8 +174,27 @@ export interface CanvasAdjustmentCurves {*/export type CanvasAdjustmentEntry =| { id: string; isEnabled: boolean; type: 'brightness-contrast'; brightness: number; contrast: number }+ | {+ id: string;+ isEnabled: boolean;+ type: 'levels';+ /** Input remap: 0–255 with `inBlack < inWhite`; `gamma` is the midtone exponent base (1 = linear). */+ inBlack: number;+ inWhite: number;+ gamma: number;+ outBlack: number;+ outWhite: number;+ }+ | { id: string; isEnabled: boolean; type: 'curves'; curves: CanvasAdjustmentCurves }| { id: string; isEnabled: boolean; type: 'hsl'; saturation: number }- | { id: string; isEnabled: boolean; type: 'curves'; curves: CanvasAdjustmentCurves };+ | {+ id: string;+ isEnabled: boolean;+ type: 'hue';+ /** Rotation around the color wheel in degrees, -180 to 180. */+ rotation: number;+ }+ | { id: string; isEnabled: boolean; type: 'invert' };/** A raster layer's ordered adjustment stack, applied top to bottom. */export type CanvasAdjustmentsContract = readonly CanvasAdjustmentEntry[];diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.test.tsindex cd81635235..bd26959105 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.test.ts@@ -22,6 +22,19 @@ const hsl = (saturation: number, overrides: EntryOverrides = {}) =>({ id: 'hsl', isEnabled: true, saturation, type: 'hsl', ...overrides }) as const;const curves = (points: CanvasAdjustmentCurves) =>({ curves: points, id: 'cv', isEnabled: true, type: 'curves' }) as const;+const levels = (+ inBlack: number,+ inWhite: number,+ gamma: number,+ outBlack: number,+ outWhite: number,+ overrides: EntryOverrides = {}+) =>+ ({ gamma, id: 'lv', inBlack, inWhite, isEnabled: true, outBlack, outWhite, type: 'levels', ...overrides }) as const;+const hue = (rotation: number, overrides: EntryOverrides = {}) =>+ ({ id: 'hue', isEnabled: true, rotation, type: 'hue', ...overrides }) as const;+const invert = (overrides: EntryOverrides = {}) =>+ ({ id: 'inv', isEnabled: true, type: 'invert', ...overrides }) as const;describe('buildCurveLut', () => {it('is the identity for absent / empty / diagonal curves', () => {@@ -102,6 +115,15 @@ describe('identity and keys', () => {).toBe(false);});+ it('recognizes identity levels and hue; invert always contributes', () => {+ expect(isIdentityAdjustments([levels(0, 255, 1, 0, 255), hue(0), hue(360)])).toBe(true);+ expect(isIdentityAdjustmentEntry(levels(1, 255, 1, 0, 255))).toBe(false);+ expect(isIdentityAdjustmentEntry(levels(0, 255, 1.1, 0, 255))).toBe(false);+ expect(isIdentityAdjustmentEntry(hue(90))).toBe(false);+ expect(isIdentityAdjustmentEntry(invert())).toBe(false);+ expect(isIdentityAdjustments([invert({ isEnabled: false })])).toBe(true);+ });+it('keys identify the pixel effect: stable across entry ids, sensitive to order and values', () => {expect(adjustmentsKey([bc(0, 0), hsl(0)])).toBe('identity');expect(adjustmentsKey([bc(0.2, 0)])).toBe(adjustmentsKey([bc(0.2, 0, { id: 'other' })]));@@ -130,6 +152,13 @@ describe('compileAdjustments', () => {expect(split.map((segment) => segment.kind)).toEqual(['lut', 'saturation', 'lut']);});+ it('folds levels and invert into the LUT chain and keeps hue as a matrix segment', () => {+ const folded = compileAdjustments([levels(10, 240, 1.2, 0, 255), invert(), bc(0.1, 0)]);+ expect(folded.map((segment) => segment.kind)).toEqual(['lut']);+ const withHue = compileAdjustments([invert(), hue(90), levels(0, 200, 1, 0, 255)]);+ expect(withHue.map((segment) => segment.kind)).toEqual(['lut', 'matrix', 'lut']);+ });+it('a folded pair produces the same pixels as sequential application', () => {const curve = curves({r: [@@ -184,6 +213,46 @@ describe('applyAdjustments', () => {expect(img.data[2]).toBe(luma);});+ it('inverts every channel exactly', () => {+ const img = imageData([0, 128, 255, 200]);+ applyAdjustments(img, [invert()]);+ expect(Array.from(img.data)).toEqual([255, 127, 0, 200]);+ });++ it('remaps through levels: input range, gamma midtones, output range', () => {+ // Input 64..192 stretched to full range: 64 → 0, 192 → 255, midpoint → 128.+ const stretch = imageData([64, 128, 192, 255]);+ applyAdjustments(stretch, [levels(64, 192, 1, 0, 255)]);+ expect(Array.from(stretch.data.slice(0, 3))).toEqual([0, 128, 255]);+ // Gamma 2 lifts midtones: 128 → 255 * (0.5)^(1/2) ≈ 180.+ const midtones = imageData([128, 0, 255, 255]);+ applyAdjustments(midtones, [levels(0, 255, 2, 0, 255)]);+ expect(midtones.data[0]).toBe(Math.round(255 * Math.sqrt(128 / 255)));+ expect(midtones.data[1]).toBe(0);+ expect(midtones.data[2]).toBe(255);+ // Output compression maps black to 50 and white to 200.+ const compress = imageData([0, 255, 128, 255]);+ applyAdjustments(compress, [levels(0, 255, 1, 50, 200)]);+ expect(compress.data[0]).toBe(50);+ expect(compress.data[1]).toBe(200);+ });++ it('hue rotation cycles the primaries and preserves grays', () => {+ // 120° sends red toward green (the standard hueRotate matrix dims it; green must dominate).+ const red = imageData([255, 0, 0, 255]);+ applyAdjustments(red, [hue(120)]);+ expect(red.data[0]).toBe(0);+ expect(red.data[2]).toBe(0);+ expect(red.data[1]).toBeGreaterThan(90);+ // A full ±360° is identity; gray is on the rotation axis and never moves.+ const gray = imageData([128, 128, 128, 255]);+ applyAdjustments(gray, [hue(90)]);+ expect(Array.from(gray.data)).toEqual([128, 128, 128, 255]);+ const wrapped = imageData([200, 100, 50, 255]);+ applyAdjustments(wrapped, [hue(360)]);+ expect(Array.from(wrapped.data)).toEqual([200, 100, 50, 255]);+ });+it('entry order changes the pixels; a disabled entry renders exactly as a removed one', () => {const source = [180, 60, 40, 255];const bcFirst = imageData([...source]);diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.tsindex 795c2db4b0..d42ffa81d0 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts@@ -123,8 +123,20 @@ export const isIdentityAdjustmentEntry = (entry: CanvasAdjustmentEntry): booleanswitch (entry.type) {case 'brightness-contrast':return entry.brightness === 0 && entry.contrast === 0;+ case 'levels':+ return (+ entry.inBlack === 0 &&+ entry.inWhite === 255 &&+ entry.gamma === 1 &&+ entry.outBlack === 0 &&+ entry.outWhite === 255+ );case 'hsl':return entry.saturation === 0;+ case 'hue':+ return entry.rotation % 360 === 0;+ case 'invert':+ return false;case 'curves':return isIdentityCurve(entry.curves.r) && isIdentityCurve(entry.curves.g) && isIdentityCurve(entry.curves.b);}@@ -138,8 +150,8 @@ export const isIdentityAdjustments = (adjustments: CanvasAdjustmentsContract | u/*** One step of the compiled pixel pass. Per-channel entries fold into LUT- * segments (adjacent ones compose into ONE lut); a saturation entry is a- * cross-channel luma lerp that cannot fold and stands alone.+ * segments (adjacent ones compose into ONE lut); saturation and hue are+ * cross-channel and stand alone.*/export type CompiledAdjustmentSegment =| {@@ -148,7 +160,8 @@ export type CompiledAdjustmentSegment =readonly g: Uint8ClampedArray;readonly b: Uint8ClampedArray;}- | { readonly kind: 'saturation'; readonly factor: number };+ | { readonly kind: 'saturation'; readonly factor: number }+ | { readonly kind: 'matrix'; readonly m: readonly number[] };const brightnessContrastLut = (brightness: number, contrast: number): Uint8ClampedArray => {const offset = brightness * 255;@@ -160,6 +173,44 @@ const brightnessContrastLut = (brightness: number, contrast: number): Uint8Clampreturn lut;};+const levelsLut = (entry: Extract<CanvasAdjustmentEntry, { type: 'levels' }>): Uint8ClampedArray => {+ const inSpan = Math.max(1, entry.inWhite - entry.inBlack);+ const outSpan = entry.outWhite - entry.outBlack;+ const exponent = 1 / Math.max(0.01, entry.gamma);+ const lut = new Uint8ClampedArray(LUT_SIZE);+ for (let i = 0; i < LUT_SIZE; i++) {+ const normalized = Math.min(1, Math.max(0, (i - entry.inBlack) / inSpan));+ lut[i] = clamp255(Math.round(entry.outBlack + Math.pow(normalized, exponent) * outSpan));+ }+ return lut;+};++const invertLut = (): Uint8ClampedArray => {+ const lut = new Uint8ClampedArray(LUT_SIZE);+ for (let i = 0; i < LUT_SIZE; i++) {+ lut[i] = 255 - i;+ }+ return lut;+};++/** The SVG feColorMatrix `hueRotate` matrix: luminance-preserving rotation around the gray axis. */+const hueRotateMatrix = (degrees: number): number[] => {+ const radians = (degrees * Math.PI) / 180;+ const cos = Math.cos(radians);+ const sin = Math.sin(radians);+ return [+ 0.213 + cos * 0.787 - sin * 0.213,+ 0.715 - cos * 0.715 - sin * 0.715,+ 0.072 - cos * 0.072 + sin * 0.928,+ 0.213 - cos * 0.213 + sin * 0.143,+ 0.715 + cos * 0.285 + sin * 0.14,+ 0.072 - cos * 0.072 - sin * 0.283,+ 0.213 - cos * 0.213 - sin * 0.787,+ 0.715 - cos * 0.715 + sin * 0.715,+ 0.072 + cos * 0.928 + sin * 0.072,+ ];+};+/** `outer` applied after `inner`, folded into one table. */const composeLut = (inner: Uint8ClampedArray, outer: Uint8ClampedArray): Uint8ClampedArray => {const lut = new Uint8ClampedArray(LUT_SIZE);@@ -170,13 +221,18 @@ const composeLut = (inner: Uint8ClampedArray, outer: Uint8ClampedArray): Uint8Cl};const entryLuts = (- entry: Extract<CanvasAdjustmentEntry, { type: 'brightness-contrast' | 'curves' }>+ entry: Extract<CanvasAdjustmentEntry, { type: 'brightness-contrast' | 'levels' | 'invert' | 'curves' }>): { r: Uint8ClampedArray; g: Uint8ClampedArray; b: Uint8ClampedArray } => {- if (entry.type === 'brightness-contrast') {- const lut = brightnessContrastLut(entry.brightness, entry.contrast);- return { b: lut, g: lut, r: lut };+ if (entry.type === 'curves') {+ return { b: buildCurveLut(entry.curves.b), g: buildCurveLut(entry.curves.g), r: buildCurveLut(entry.curves.r) };}- return { b: buildCurveLut(entry.curves.b), g: buildCurveLut(entry.curves.g), r: buildCurveLut(entry.curves.r) };+ const lut =+ entry.type === 'brightness-contrast'+ ? brightnessContrastLut(entry.brightness, entry.contrast)+ : entry.type === 'levels'+ ? levelsLut(entry)+ : invertLut();+ return { b: lut, g: lut, r: lut };};/**@@ -194,6 +250,10 @@ export const compileAdjustments = (adjustments: CanvasAdjustmentsContract | undesegments.push({ factor: 1 + entry.saturation, kind: 'saturation' });continue;}+ if (entry.type === 'hue') {+ segments.push({ kind: 'matrix', m: hueRotateMatrix(entry.rotation) });+ continue;+ }const luts = entryLuts(entry);const last = segments[segments.length - 1];if (last?.kind === 'lut') {@@ -223,8 +283,14 @@ export const adjustmentsKey = (adjustments: CanvasAdjustmentsContract | undefineswitch (entry.type) {case 'brightness-contrast':return `bc:${entry.brightness},${entry.contrast}`;+ case 'levels':+ return `lv:${entry.inBlack},${entry.inWhite},${entry.gamma},${entry.outBlack},${entry.outWhite}`;case 'hsl':return `s:${entry.saturation}`;+ case 'hue':+ return `h:${entry.rotation}`;+ case 'invert':+ return 'inv';case 'curves':return `cv:${curveKey(entry.curves.r)}|${curveKey(entry.curves.g)}|${curveKey(entry.curves.b)}`;}@@ -252,11 +318,19 @@ export const applyAdjustments = (imageData: ImageData, adjustments: CanvasAdjustr = segment.r[r];g = segment.g[g];b = segment.b[b];- } else {+ } else if (segment.kind === 'saturation') {const lum = LUMA_R * r + LUMA_G * g + LUMA_B * b;r = clamp255(Math.round(lum + (r - lum) * segment.factor));g = clamp255(Math.round(lum + (g - lum) * segment.factor));b = clamp255(Math.round(lum + (b - lum) * segment.factor));+ } else {+ const { m } = segment;+ const nr = m[0] * r + m[1] * g + m[2] * b;+ const ng = m[3] * r + m[4] * g + m[5] * b;+ const nb = m[6] * r + m[7] * g + m[8] * b;+ r = clamp255(Math.round(nr));+ g = clamp255(Math.round(ng));+ b = clamp255(Math.round(nb));}}data[i] = r;diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.tsindex 5e2726fce4..130815e070 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.ts@@ -1,6 +1,6 @@/*** The display-only effects a layer's pixels pass through on the way to screen:- * raster **adjustments** (brightness / contrast / saturation / curves) and the+ * the raster **adjustment stack** and the* control-layer **transparency effect** (lightness→alpha, so a dark control map* drops its background out).*diff --git a/invokeai/frontend/webv2/src/workbench/canvasMigration.test.ts b/invokeai/frontend/webv2/src/workbench/canvasMigration.test.tsindex 4bff5979b7..c2cef28ab3 100644--- a/invokeai/frontend/webv2/src/workbench/canvasMigration.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvasMigration.test.ts@@ -119,6 +119,9 @@ describe('loadCanvasState', () => {isEnabled: true,type: 'curves',},+ { gamma: 1.4, id: 'a4', inBlack: 12, inWhite: 240, isEnabled: true, outBlack: 5, outWhite: 250, type: 'levels' },+ { id: 'a5', isEnabled: true, rotation: -45, type: 'hue' },+ { id: 'a6', isEnabled: false, type: 'invert' },];const adjustmentsOf = (loaded: CanvasStateContractV3) => {const layer = loaded.document.stacks.raster[0];@@ -149,6 +152,28 @@ describe('loadCanvasState', () => {);expect(adjustmentsOf(malformed)).toBeUndefined();expect(malformed.document.stacks.raster).toHaveLength(1);++ // Levels cross-field invariants are enforced: an inverted input range or non-positive gamma is malformed.+ const invalidLevels = load(+ withNodes([+ {+ ...createEmptyPaintLayer('Inverted', 'inverted'),+ adjustments: [+ {+ gamma: 1,+ id: 'l1',+ inBlack: 200,+ inWhite: 100,+ isEnabled: true,+ outBlack: 0,+ outWhite: 255,+ type: 'levels',+ },+ ],+ },+ ])+ );+ expect(adjustmentsOf(invalidLevels)).toBeUndefined();});it('normalizes control adapters in both the live document and saved snapshots', () => {diff --git a/invokeai/frontend/webv2/src/workbench/canvasMigration.ts b/invokeai/frontend/webv2/src/workbench/canvasMigration.tsindex 4542d107d3..76194b204d 100644--- a/invokeai/frontend/webv2/src/workbench/canvasMigration.ts+++ b/invokeai/frontend/webv2/src/workbench/canvasMigration.ts@@ -99,6 +99,20 @@ const zAdjustmentEntry = z.discriminatedUnion('type', [isEnabled: z.boolean(),type: z.literal('curves'),}),+ z+ .object({+ gamma: zFiniteNumber,+ id: z.string(),+ inBlack: zFiniteNumber,+ inWhite: zFiniteNumber,+ isEnabled: z.boolean(),+ outBlack: zFiniteNumber,+ outWhite: zFiniteNumber,+ type: z.literal('levels'),+ })+ .refine((entry) => entry.inBlack < entry.inWhite && entry.gamma > 0),+ z.object({ id: z.string(), isEnabled: z.boolean(), rotation: zFiniteNumber, type: z.literal('hue') }),+ z.object({ id: z.string(), isEnabled: z.boolean(), type: z.literal('invert') }),]);const zAdjustments = z.array(zAdjustmentEntry);const zControlAdapter = zdiff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.browser.test.tsxindex 07e0cb3ab1..62706e92b8 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.browser.test.tsx@@ -37,6 +37,8 @@ let root: Root | null = null;const initialEntries = (): CanvasAdjustmentEntry[] => [{ brightness: 0.1, contrast: 0, id: 'bc1', isEnabled: true, type: 'brightness-contrast' },{ curves: {}, id: 'cv1', isEnabled: true, type: 'curves' },+ { id: 'hue1', isEnabled: true, rotation: 0, type: 'hue' },+ { gamma: 1, id: 'lv1', inBlack: 0, inWhite: 255, isEnabled: true, outBlack: 0, outWhite: 255, type: 'levels' },];const createLayer = (): CanvasRasterLayerContractV2 =>@@ -56,7 +58,7 @@ const createLayer = (): CanvasRasterLayerContractV2 =>const commits: PreparedDocumentEdit[] = [];let latestAdjustments: unknown = 'untouched';-const Harness = () => {+const Harness = ({ entryId }: { entryId: string }) => {const [layer, setLayer] = useState(createLayer);const engine = useMemo(() => {@@ -90,7 +92,7 @@ const Harness = () => {// Rebuilt per layer change so the stub's model reflects the previewed layer, as the engine's does.}, [layer]);- return <AdjustmentSettings engine={engine} entryId="cv1" layer={layer} />;+ return <AdjustmentSettings engine={engine} entryId={entryId} layer={layer} />;};const settle = (action: () => void): Promise<void> =>@@ -101,7 +103,7 @@ const settle = (action: () => void): Promise<void> =>});});-const render = async () => {+const render = async (entryId = 'cv1') => {applyThemeToRoot('classic');host = document.createElement('div');host.style.width = '260px';@@ -112,7 +114,7 @@ const render = async () => {root?.render(<I18nextProvider i18n={i18n}><ChakraProvider value={system}>- <Harness />+ <Harness entryId={entryId} /></ChakraProvider></I18nextProvider>);@@ -143,6 +145,49 @@ afterEach(async () => {root = null;});+const sliderTracks = (): HTMLElement[] => Array.from(host!.querySelectorAll<HTMLElement>('[data-part="track"]'));++/** A pointer press-and-release on a slider track at `fraction` of its width. */+const pressTrack = async (track: HTMLElement, fraction: number): Promise<void> => {+ const rect = track.getBoundingClientRect();+ const x = rect.left + rect.width * fraction;+ const y = rect.top + rect.height / 2;+ await settle(() => pointer(track, 'pointerdown', x, y));+ await settle(() => pointer(track, 'pointerup', x, y));+};++const forwardEntries = (edit: PreparedDocumentEdit): CanvasAdjustmentEntry[] =>+ (edit.forward as unknown as { config: { adjustments: CanvasAdjustmentEntry[] } }).config.adjustments;++describe('hue and levels editors', () => {+ it('commits a hue rotation as one whole-stack patch', async () => {+ await render('hue1');+ const [track] = sliderTracks();+ expect(track).toBeDefined();+ await pressTrack(track!, 0.75);++ expect(commits).toHaveLength(1);+ const forward = forwardEntries(commits[0]!);+ expect(forward[2]).toMatchObject({ id: 'hue1', type: 'hue' });+ expect((forward[2] as { rotation: number }).rotation).toBeCloseTo(90, -1);+ // Untouched siblings ride along unchanged.+ expect(forward[0]).toEqual(initialEntries()[0]);+ });++ it('commits a levels input-range change while the other fields keep their values', async () => {+ await render('lv1');+ const tracks = sliderTracks();+ expect(tracks).toHaveLength(3);+ await pressTrack(tracks[0]!, 0.25);++ expect(commits).toHaveLength(1);+ const entry = forwardEntries(commits[0]!)[3] as Extract<CanvasAdjustmentEntry, { type: 'levels' }>;+ expect(entry).toMatchObject({ gamma: 1, id: 'lv1', inWhite: 255, outBlack: 0, outWhite: 255 });+ expect(entry.inBlack).toBeGreaterThan(50);+ expect(entry.inBlack).toBeLessThan(80);+ });+});+describe('curves entry editor', () => {it('moves a handle while dragging and commits the whole stack with the pre-gesture inverse', async () => {const svg = await render();diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsxindex 311b066cc9..88ae62c855 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx@@ -149,13 +149,21 @@ const AdjustmentEntryEditor = ({}, [engine, layer.id]);const handleScalarLive = useCallback(- (field: 'brightness' | 'contrast' | 'saturation', next: number) =>- patchLive({ ...entry, [field]: next } as CanvasAdjustmentEntry),+ (field: ScalarField, next: number) => patchLive({ ...entry, [field]: next } as CanvasAdjustmentEntry),[entry, patchLive]);const handleScalarCommit = useCallback(- (field: 'brightness' | 'contrast' | 'saturation', next: number) =>- commitEntry(t(`widgets.layers.adjustments.${field}`), { ...entry, [field]: next } as CanvasAdjustmentEntry),+ (field: ScalarField, next: number) =>+ commitEntry(t(SCALAR_LABEL_KEYS[field]), { ...entry, [field]: next } as CanvasAdjustmentEntry),+ [commitEntry, entry, t]+ );+ const handleLevelsLive = useCallback(+ (patch: Partial<LevelsEntry>) => patchLive({ ...entry, ...patch } as CanvasAdjustmentEntry),+ [entry, patchLive]+ );+ const handleLevelsCommit = useCallback(+ (patch: Partial<LevelsEntry>) =>+ commitEntry(t('widgets.layers.adjustments.levels'), { ...entry, ...patch } as CanvasAdjustmentEntry),[commitEntry, entry, t]);const handleCurvesLive = useCallback(@@ -198,6 +206,28 @@ const AdjustmentEntryEditor = ({onLive={handleScalarLive}/>);+ case 'hue':+ return (+ <ScalarSlider+ field="rotation"+ formatValue={formatDegrees}+ label={t('widgets.layers.adjustments.hue')}+ max={180}+ min={-180}+ step={1}+ value={entry.rotation}+ onCommit={handleScalarCommit}+ onLive={handleScalarLive}+ />+ );+ case 'levels':+ return <LevelsEditor entry={entry} onCommit={handleLevelsCommit} onLive={handleLevelsLive} />;+ case 'invert':+ return (+ <Text color="fg.muted" fontSize="xs">+ {t('widgets.layers.adjustments.invertHint')}+ </Text>+ );case 'curves':return (<CurvesEditor@@ -210,17 +240,35 @@ const AdjustmentEntryEditor = ({}};-type ScalarField = 'brightness' | 'contrast' | 'saturation';+type ScalarField = 'brightness' | 'contrast' | 'saturation' | 'rotation';+type LevelsEntry = Extract<CanvasAdjustmentEntry, { type: 'levels' }>;++const SCALAR_LABEL_KEYS: Record<ScalarField, string> = {+ brightness: 'widgets.layers.adjustments.brightness',+ contrast: 'widgets.layers.adjustments.contrast',+ rotation: 'widgets.layers.adjustments.hue',+ saturation: 'widgets.layers.adjustments.saturation',+};++const formatDegrees = (value: number): string => `${Math.round(value)}°`;const ScalarSlider = ({field,+ formatValue = formatSigned,label,+ max = 1,+ min = -1,onCommit,onLive,+ step = 0.01,value,}: {field: ScalarField;+ formatValue?: (value: number) => string;label: string;+ max?: number;+ min?: number;+ step?: number;value: number;onLive: (field: ScalarField, next: number) => void;onCommit: (field: ScalarField, next: number) => void;@@ -252,11 +300,11 @@ const ScalarSlider = ({<Field label={label}><Slideraria-label={aria}- formatValue={formatSigned}- max={1}- min={-1}+ formatValue={formatValue}+ max={max}+ min={min}size="sm"- step={0.01}+ step={step}value={sliderValue}withThumbTooltiponValueChange={handleChange}@@ -266,6 +314,137 @@ const ScalarSlider = ({);};+const formatGamma = (value: number): string => value.toFixed(2);++/** A pair-of-thumbs range plus a gamma midtone: the classic input/output levels remap. */+const LevelsEditor = ({+ entry,+ onCommit,+ onLive,+}: {+ entry: LevelsEntry;+ onLive: (patch: Partial<LevelsEntry>) => void;+ onCommit: (patch: Partial<LevelsEntry>) => void;+}) => {+ const { t } = useTranslation();+ const inputValue = useMemo(() => [entry.inBlack, entry.inWhite], [entry.inBlack, entry.inWhite]);+ const gammaValue = useMemo(() => [entry.gamma], [entry.gamma]);+ const outputValue = useMemo(() => [entry.outBlack, entry.outWhite], [entry.outBlack, entry.outWhite]);+ const inputAria = useMemo(+ () => [t('widgets.layers.adjustments.inputBlack'), t('widgets.layers.adjustments.inputWhite')],+ [t]+ );+ const gammaAria = useMemo(() => [t('widgets.layers.adjustments.gamma')], [t]);+ const outputAria = useMemo(+ () => [t('widgets.layers.adjustments.outputBlack'), t('widgets.layers.adjustments.outputWhite')],+ [t]+ );++ const rangePatch = useCallback(+ (v: number[], black: 'inBlack' | 'outBlack', white: 'inWhite' | 'outWhite'): Partial<LevelsEntry> | null =>+ v[0] !== undefined && v[1] !== undefined ? { [black]: v[0], [white]: v[1] } : null,+ []+ );+ const handleInputChange = useCallback(+ ({ value: v }: SliderValueChangeDetails) => {+ const patch = rangePatch(v, 'inBlack', 'inWhite');+ if (patch) {+ onLive(patch);+ }+ },+ [onLive, rangePatch]+ );+ const handleInputCommit = useCallback(+ ({ value: v }: SliderValueChangeDetails) => {+ const patch = rangePatch(v, 'inBlack', 'inWhite');+ if (patch) {+ onCommit(patch);+ }+ },+ [onCommit, rangePatch]+ );+ const handleOutputChange = useCallback(+ ({ value: v }: SliderValueChangeDetails) => {+ const patch = rangePatch(v, 'outBlack', 'outWhite');+ if (patch) {+ onLive(patch);+ }+ },+ [onLive, rangePatch]+ );+ const handleOutputCommit = useCallback(+ ({ value: v }: SliderValueChangeDetails) => {+ const patch = rangePatch(v, 'outBlack', 'outWhite');+ if (patch) {+ onCommit(patch);+ }+ },+ [onCommit, rangePatch]+ );+ const handleGammaChange = useCallback(+ ({ value: v }: SliderValueChangeDetails) => {+ if (v[0] !== undefined && Number.isFinite(v[0])) {+ onLive({ gamma: v[0] });+ }+ },+ [onLive]+ );+ const handleGammaCommit = useCallback(+ ({ value: v }: SliderValueChangeDetails) => {+ if (v[0] !== undefined && Number.isFinite(v[0])) {+ onCommit({ gamma: v[0] });+ }+ },+ [onCommit]+ );++ return (+ <Stack gap="3">+ <Field label={t('widgets.layers.adjustments.inputLevels')}>+ <Slider+ aria-label={inputAria}+ max={255}+ min={0}+ minStepsBetweenThumbs={1}+ size="sm"+ step={1}+ value={inputValue}+ withThumbTooltip+ onValueChange={handleInputChange}+ onValueChangeEnd={handleInputCommit}+ />+ </Field>+ <Field label={t('widgets.layers.adjustments.gamma')}>+ <Slider+ aria-label={gammaAria}+ formatValue={formatGamma}+ max={4}+ min={0.1}+ size="sm"+ step={0.01}+ value={gammaValue}+ withThumbTooltip+ onValueChange={handleGammaChange}+ onValueChangeEnd={handleGammaCommit}+ />+ </Field>+ <Field label={t('widgets.layers.adjustments.outputLevels')}>+ <Slider+ aria-label={outputAria}+ max={255}+ min={0}+ size="sm"+ step={1}+ value={outputValue}+ withThumbTooltip+ onValueChange={handleOutputChange}+ onValueChangeEnd={handleOutputCommit}+ />+ </Field>+ </Stack>+ );+};+const sameChannel = (left: CanvasAdjustmentCurves, right: CanvasAdjustmentCurves, channel: CurveChannel): boolean =>JSON.stringify(left[channel] ?? IDENTITY_CURVE) === JSON.stringify(right[channel] ?? IDENTITY_CURVE);diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsxindex 076a6e594f..f7d289fe65 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx@@ -3,14 +3,25 @@ import type { CSSProperties, KeyboardEvent, MouseEvent } from 'react';import { Box, HStack, Icon, Text } from '@chakra-ui/react';import { useDraggable, useDroppable } from '@dnd-kit/core';import { Row } from '@platform/ui';-import { DropletIcon, GaugeIcon, ImageIcon, SplineIcon, SunMediumIcon, WavesIcon, type LucideIcon } from 'lucide-react';+import {+ ContrastIcon,+ DropletIcon,+ GaugeIcon,+ ImageIcon,+ RainbowIcon,+ SlidersVerticalIcon,+ SplineIcon,+ SunMediumIcon,+ WavesIcon,+ type LucideIcon,+} from 'lucide-react';import { memo, useCallback, useMemo, useRef } from 'react';import { useTranslation } from 'react-i18next';import type { LayerRowCommands } from './layerRowCommands';import { LayerActiveDot, ROW_SELECTION_FOCUS } from './LayerActiveDot';-import { isOrderedChildKind, type LayerChildRowKind, type ProjectedChildRow } from './layerChildRows';+import { childRowNameKey, isOrderedChildKind, type LayerChildRowKind, type ProjectedChildRow } from './layerChildRows';import { LAYER_TREE_INDENT_PX } from './layerPanelRows';import { anchorFromPoint } from './layerRowCommands';@@ -20,6 +31,9 @@ const CHILD_ROW_GLYPHS: Record<LayerChildRowKind, LucideIcon> = {'adjustment-brightness-contrast': SunMediumIcon,'adjustment-curves': SplineIcon,'adjustment-hsl': DropletIcon,+ 'adjustment-hue': RainbowIcon,+ 'adjustment-invert': ContrastIcon,+ 'adjustment-levels': SlidersVerticalIcon,'mask-denoise': GaugeIcon,'mask-noise': WavesIcon,'reference-image': ImageIcon,@@ -30,22 +44,10 @@ export const isDraggableChildKind = (kind: LayerChildRowKind): boolean =>kind === 'reference-image' || isOrderedChildKind(kind);/** The row's display name; reference images are numbered, other modifiers named by kind. */-export const childRowName = (child: ProjectedChildRow, t: (key: string) => string): string => {- switch (child.kind) {- case 'reference-image':- return `${t('widgets.layers.regionalGuidance.referenceImage')} ${child.posInSet}`;- case 'mask-noise':- return t('widgets.layers.modifiers.noise');- case 'mask-denoise':- return t('widgets.layers.modifiers.denoise');- case 'adjustment-brightness-contrast':- return t('widgets.layers.modifiers.brightnessContrast');- case 'adjustment-hsl':- return t('widgets.layers.adjustments.saturation');- case 'adjustment-curves':- return t('widgets.layers.adjustments.curves');- }-};+export const childRowName = (child: ProjectedChildRow, t: (key: string) => string): string =>+ child.kind === 'reference-image'+ ? `${t('widgets.layers.regionalGuidance.referenceImage')} ${child.posInSet}`+ : t(childRowNameKey(child.kind));interface LayerChildRowProps {child: ProjectedChildRow;@@ -200,9 +202,9 @@ const LayerChildRowComponent = ({<Text color={muted ? 'fg.muted' : undefined} flex="1" fontSize="2xs" fontWeight="600" minW="0" truncate>{name}</Text>- {child.value !== null ? (+ {child.detail !== null ? (<Text color="fg.subtle" flexShrink={0} fontSize="2xs" fontVariantNumeric="tabular-nums">- {`${Math.round(child.value * 100)}%`}+ {child.detail}</Text>) : null}</Row>diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsxindex 3dc8d9285d..e6ba1faa76 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx@@ -1,4 +1,5 @@import type {+ CanvasAdjustmentEntry,CanvasDocumentContractV3,CanvasLayerContract,CanvasMaskContract,@@ -100,7 +101,7 @@ import {copyRasterToRegionalGuidance,copyRegionalGuidanceToInpaintMask,createLayerId,- createAdjustmentId,+ createIdentityAdjustment,createRegionalReferenceImage,fitLayerTransformToBbox,getControlTransparencyEffectPatch,@@ -736,17 +737,11 @@ const LayerMenu = ({);const handleAddAdjustment = useCallback(- (type: 'brightness-contrast' | 'hsl' | 'curves') => {+ (type: CanvasAdjustmentEntry['type']) => {if (layer.type !== 'raster') {return;}- const id = createAdjustmentId();- const entry =- type === 'brightness-contrast'- ? { brightness: 0, contrast: 0, id, isEnabled: true, type }- : type === 'hsl'- ? { id, isEnabled: true, saturation: 0, type }- : { curves: {}, id, isEnabled: true, type };+ const entry = createIdentityAdjustment(type);const before = layer.adjustments ?? [];commitPrepared(t('widgets.layers.menu.addAdjustment'), (model) =>model.prepare({diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.test.tsindex ef17491dcd..74b2929c86 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.test.ts@@ -1,4 +1,4 @@-import type { RegionalGuidanceReferenceImage } from '@workbench/canvas-engine/api';+import type { CanvasAdjustmentEntry, RegionalGuidanceReferenceImage } from '@workbench/canvas-engine/api';import { documentFrom, layerContract } from '@workbench/canvas-engine/document-model/documentFixtures.testStub';import { describe, expect, it } from 'vitest';@@ -130,9 +130,9 @@ describe('mask modifier rows', () => {maskWith({ denoise: { isEnabled: false, limit: 0.8 }, noise: { isEnabled: true, level: 0.25 } }),]);const rows = projectLayerChildRows(maskRow(document).vm);- expect(rows.map((row) => [row.kind, row.itemId, row.isEnabled, row.value, row.posInSet, row.setSize])).toEqual([- ['mask-noise', 'noise', true, 0.25, 1, 2],- ['mask-denoise', 'denoise', false, 0.8, 2, 2],+ expect(rows.map((row) => [row.kind, row.itemId, row.isEnabled, row.detail, row.posInSet, row.setSize])).toEqual([+ ['mask-noise', 'noise', true, '25%', 1, 2],+ ['mask-denoise', 'denoise', false, '80%', 2, 2],]);expect(projectLayerChildRows(maskRow(documentFrom([maskWith()])).vm)).toEqual([]);});@@ -176,21 +176,50 @@ describe('adjustment rows', () => {{ id: 'a2', isEnabled: false, saturation: -0.4, type: 'hsl' as const },{ curves: {}, id: 'a3', isEnabled: true, type: 'curves' as const },];- const rasterWith = (adjustments = entries()) => layerContract('r1', 'raster', { adjustments });+ const rasterWith = (adjustments: CanvasAdjustmentEntry[] = entries()) =>+ layerContract('r1', 'raster', { adjustments });const rasterRow = (document: ReturnType<typeof documentFrom>) =>buildLayerStackRows(document.stacks, new Set()).raster.rows.find((row) => row.id === 'r1')!;- it('projects one row per entry, in stack order, with per-kind identity and the hsl value', () => {+ it('projects one row per entry, in stack order, with per-kind identity and details', () => {const rows = projectLayerChildRows(rasterRow(documentFrom([rasterWith()])).vm);- expect(rows.map((row) => [row.kind, row.itemId, row.isEnabled, row.value])).toEqual([+ expect(rows.map((row) => [row.kind, row.itemId, row.isEnabled, row.detail])).toEqual([['adjustment-brightness-contrast', 'a1', true, null],- ['adjustment-hsl', 'a2', false, -0.4],+ ['adjustment-hsl', 'a2', false, '-40%'],['adjustment-curves', 'a3', true, null],]);expect(rows[1]).toMatchObject({ posInSet: 2, setSize: 3 });expect(projectLayerChildRows(rasterRow(documentFrom([rasterWith([])])).vm)).toEqual([]);});+ it('projects levels, hue and invert entries with their kinds and details', () => {+ const rows = projectLayerChildRows(+ rasterRow(+ documentFrom([+ rasterWith([+ {+ gamma: 1.2,+ id: 'l1',+ inBlack: 10,+ inWhite: 240,+ isEnabled: true,+ outBlack: 0,+ outWhite: 255,+ type: 'levels',+ },+ { id: 'h1', isEnabled: true, rotation: 90, type: 'hue' },+ { id: 'i1', isEnabled: false, type: 'invert' },+ ]),+ ])+ ).vm+ );+ expect(rows.map((row) => [row.kind, row.itemId, row.isEnabled, row.detail])).toEqual([+ ['adjustment-levels', 'l1', true, null],+ ['adjustment-hue', 'h1', true, '90°'],+ ['adjustment-invert', 'i1', false, null],+ ]);+ });+it('moves an entry within the stack and refuses moves past the ends', () => {const document = documentFrom([rasterWith()]);const moved = layerChildRowCommand(document, { itemId: 'a2', layerId: 'r1' }, { direction: -1, type: 'move' });diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.tsindex 3b41acdacf..b22998fcae 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts@@ -25,16 +25,57 @@ export type LayerChildRowKind =| 'mask-noise'| 'mask-denoise'| 'adjustment-brightness-contrast'+ | 'adjustment-levels'+ | 'adjustment-curves'| 'adjustment-hsl'- | 'adjustment-curves';+ | 'adjustment-hue'+ | 'adjustment-invert';++type AdjustmentChildKind = Extract<LayerChildRowKind, `adjustment-${string}`>;/** The row kind projecting an adjustment entry of `type`. */-export const adjustmentChildKind = (type: CanvasAdjustmentEntry['type']): LayerChildRowKind => ADJUSTMENT_KIND_OF[type];+export const adjustmentChildKind = (type: CanvasAdjustmentEntry['type']): AdjustmentChildKind =>+ ADJUSTMENT_KIND_OF[type];-const ADJUSTMENT_KIND_OF: Record<CanvasAdjustmentEntry['type'], LayerChildRowKind> = {+const ADJUSTMENT_KIND_OF: Record<CanvasAdjustmentEntry['type'], AdjustmentChildKind> = {'brightness-contrast': 'adjustment-brightness-contrast',curves: 'adjustment-curves',hsl: 'adjustment-hsl',+ hue: 'adjustment-hue',+ invert: 'adjustment-invert',+ levels: 'adjustment-levels',+};++const CHILD_ROW_NAME_KEYS: Record<Exclude<LayerChildRowKind, 'reference-image'>, string> = {+ 'adjustment-brightness-contrast': 'widgets.layers.modifiers.brightnessContrast',+ 'adjustment-curves': 'widgets.layers.adjustments.curves',+ 'adjustment-hsl': 'widgets.layers.adjustments.saturation',+ 'adjustment-hue': 'widgets.layers.adjustments.hue',+ 'adjustment-invert': 'widgets.layers.adjustments.invert',+ 'adjustment-levels': 'widgets.layers.adjustments.levels',+ 'mask-denoise': 'widgets.layers.modifiers.denoise',+ 'mask-noise': 'widgets.layers.modifiers.noise',+};++/** The i18n key naming a non-reference child row's kind, for rows and editor subtitles alike. */+export const childRowNameKey = (kind: Exclude<LayerChildRowKind, 'reference-image'>): string =>+ CHILD_ROW_NAME_KEYS[kind];++const signedPercent = (value: number): string => `${value > 0 ? '+' : ''}${Math.round(value * 100)}%`;++/** The compact fact shown beside an adjustment row's name, or `null` when it has none. */+const adjustmentDetail = (entry: CanvasAdjustmentEntry): string | null => {+ switch (entry.type) {+ case 'hsl':+ return signedPercent(entry.saturation);+ case 'hue':+ return `${Math.round(entry.rotation)}°`;+ case 'brightness-contrast':+ case 'levels':+ case 'curves':+ case 'invert':+ return null;+ }};/** Kinds whose list order is document truth; their rows offer Move up/down and Duplicate. */@@ -59,8 +100,8 @@ export interface ProjectedChildRow {/** The owning layer and its ancestors are enabled; a gated dot when not. */readonly parentContributing: boolean;readonly image: { readonly imageName: string; readonly thumbnailUrl: string } | null;- /** The modifier's 0–1 magnitude, shown beside the name; `null` for reference images. */- readonly value: number | null;+ /** A compact preformatted fact shown beside the name (a percent, degrees), or `null`. */+ readonly detail: string | null;}export type LayerChildRowAction =@@ -90,18 +131,18 @@ const maskModifierRows = (vm: SemanticNode, layer: CanvasInpaintMaskLayerContracconst items = [layer.noise? {+ detail: `${Math.round(layer.noise.level * 100)}%`,isEnabled: layer.noise.isEnabled,itemId: MASK_NOISE_ITEM_ID,kind: 'mask-noise' as const,- value: layer.noise.level,}: null,layer.denoise? {+ detail: `${Math.round(layer.denoise.limit * 100)}%`,isEnabled: layer.denoise.isEnabled,itemId: MASK_DENOISE_ITEM_ID,kind: 'mask-denoise' as const,- value: layer.denoise.limit,}: null,].filter((item) => item !== null);@@ -127,6 +168,7 @@ export const projectLayerChildRows = (vm: SemanticNode): readonly ProjectedChildconst setSize = node.referenceImages.length;rows = node.referenceImages.map((ref, index): ProjectedChildRow => ({...baseRow(vm),+ detail: null,image: ref.config.image? { imageName: ref.config.image.imageName, thumbnailUrl: ref.config.image.thumbnailUrl }: null,@@ -136,7 +178,6 @@ export const projectLayerChildRows = (vm: SemanticNode): readonly ProjectedChildkind: 'reference-image',posInSet: index + 1,setSize,- value: null,}));} else if (node.type === 'inpaint_mask' && (node.noise || node.denoise)) {rows = maskModifierRows(vm, node);@@ -144,6 +185,7 @@ export const projectLayerChildRows = (vm: SemanticNode): readonly ProjectedChildconst setSize = node.adjustments.length;rows = node.adjustments.map((adjustment, index): ProjectedChildRow => ({...baseRow(vm),+ detail: adjustmentDetail(adjustment),image: null,isEnabled: adjustment.isEnabled,itemId: adjustment.id,@@ -151,7 +193,6 @@ export const projectLayerChildRows = (vm: SemanticNode): readonly ProjectedChildkind: ADJUSTMENT_KIND_OF[adjustment.type],posInSet: index + 1,setSize,- value: adjustment.type === 'hsl' ? adjustment.saturation : null,}));} else {return EMPTY_CHILD_ROWS;@@ -196,8 +237,11 @@ export const layerChildRemoveLabelKey = (kind: LayerChildRowKind): string => {case 'mask-denoise':return 'widgets.layers.modifiers.removeDenoise';case 'adjustment-brightness-contrast':- case 'adjustment-hsl':+ case 'adjustment-levels':case 'adjustment-curves':+ case 'adjustment-hsl':+ case 'adjustment-hue':+ case 'adjustment-invert':return 'widgets.layers.modifiers.removeAdjustment';}};diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.test.tsindex 1ede0bead6..94d42db63e 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.test.ts@@ -456,8 +456,11 @@ describe('getLayerContextActions', () => {'transform','fit-to-bbox','add-brightness-contrast',- 'add-hsl',+ 'add-levels','add-curves',+ 'add-hsl',+ 'add-hue',+ 'add-invert','save-to-assets','copy-to-clipboard','crop-to-bbox',@@ -537,8 +540,11 @@ describe('getLayerContextActions', () => {for (const id of ['fit-to-bbox','add-brightness-contrast',- 'add-hsl',+ 'add-levels','add-curves',+ 'add-hsl',+ 'add-hue',+ 'add-invert','filter','select-object','run-workflow',@@ -613,8 +619,11 @@ describe('getLayerContextActions', () => {'transform','fit-to-bbox','add-brightness-contrast',- 'add-hsl',+ 'add-levels','add-curves',+ 'add-hsl',+ 'add-hue',+ 'add-invert','save-to-assets','copy-to-clipboard','crop-to-bbox',diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.tsindex 16c89b0f82..46e6f65544 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts@@ -1,5 +1,6 @@import type {BooleanRasterOperation,+ CanvasAdjustmentEntry,CanvasDocumentContractV3,CanvasLayerContract,LayerStackMoveKind,@@ -33,7 +34,10 @@ import {MergeIcon,PencilIcon,SaveIcon,+ ContrastIcon,+ RainbowIcon,ScanSearchIcon,+ SlidersVerticalIcon,SplineIcon,SunMediumIcon,WavesIcon,@@ -49,8 +53,11 @@ export type LayerContextActionId =| 'add-noise'| 'add-denoise-limit'| 'add-brightness-contrast'- | 'add-hsl'+ | 'add-levels'| 'add-curves'+ | 'add-hsl'+ | 'add-hue'+ | 'add-invert'| 'merge-selected'| 'move-to-front'| 'move-forward'@@ -138,7 +145,7 @@ export interface LayerContextActionEffects {patchConfig(kind: LayerConfigPatchKind): void;addReferenceImage(): void;addMaskModifier(field: 'noise' | 'denoise'): void;- addAdjustment(type: 'brightness-contrast' | 'hsl' | 'curves'): void;+ addAdjustment(type: CanvasAdjustmentEntry['type']): void;mergeDown(): void;toggleVisibility(): void;toggleHidden(): void;@@ -426,14 +433,14 @@ export const LAYER_CONTEXT_ACTION_DEFINITIONS: readonly LayerContextActionDefinisupportedLayerTypes: RASTER_ONLY,},{- defaultLabel: 'Saturation',- handler: ({ effects }) => effects.addAdjustment('hsl'),- icon: DropletIcon,- id: 'add-hsl',+ defaultLabel: 'Levels',+ handler: ({ effects }) => effects.addAdjustment('levels'),+ icon: SlidersVerticalIcon,+ id: 'add-levels',isEnabled: isLayerMutable,isVisible: alwaysVisible,- labelKey: 'widgets.layers.adjustments.saturation',- order: 31.2,+ labelKey: 'widgets.layers.adjustments.levels',+ order: 31.1,section: 'primary',submenu: 'add-adjustment',supportedLayerTypes: RASTER_ONLY,@@ -446,11 +453,50 @@ export const LAYER_CONTEXT_ACTION_DEFINITIONS: readonly LayerContextActionDefiniisEnabled: isLayerMutable,isVisible: alwaysVisible,labelKey: 'widgets.layers.adjustments.curves',+ order: 31.2,+ section: 'primary',+ submenu: 'add-adjustment',+ supportedLayerTypes: RASTER_ONLY,+ },+ {+ defaultLabel: 'Saturation',+ handler: ({ effects }) => effects.addAdjustment('hsl'),+ icon: DropletIcon,+ id: 'add-hsl',+ isEnabled: isLayerMutable,+ isVisible: alwaysVisible,+ labelKey: 'widgets.layers.adjustments.saturation',+ order: 31.3,+ section: 'primary',+ submenu: 'add-adjustment',+ supportedLayerTypes: RASTER_ONLY,+ },+ {+ defaultLabel: 'Hue',+ handler: ({ effects }) => effects.addAdjustment('hue'),+ icon: RainbowIcon,+ id: 'add-hue',+ isEnabled: isLayerMutable,+ isVisible: alwaysVisible,+ labelKey: 'widgets.layers.adjustments.hue',order: 31.4,section: 'primary',submenu: 'add-adjustment',supportedLayerTypes: RASTER_ONLY,},+ {+ defaultLabel: 'Invert',+ handler: ({ effects }) => effects.addAdjustment('invert'),+ icon: ContrastIcon,+ id: 'add-invert',+ isEnabled: isLayerMutable,+ isVisible: alwaysVisible,+ labelKey: 'widgets.layers.adjustments.invert',+ order: 31.5,+ section: 'primary',+ submenu: 'add-adjustment',+ supportedLayerTypes: RASTER_ONLY,+ },{defaultLabel: 'Filter',handler: ({ effects, layer }) => effects.startFilter(layer.id),diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextMenuLayout.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextMenuLayout.test.tsindex 390b0dc825..16bf46b0a5 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextMenuLayout.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextMenuLayout.test.ts@@ -87,7 +87,7 @@ describe('getLayerContextMenuLayout', () => {'transform','rename','fit-to-bbox',- 'add-adjustment(add-brightness-contrast,add-hsl,add-curves)',+ 'add-adjustment(add-brightness-contrast,add-levels,add-curves,add-hsl,add-hue,add-invert)','filter','select-object','run-workflow',diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.tsindex 5e692acd62..65a76db532 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts@@ -4,6 +4,7 @@*/import type {+ CanvasAdjustmentEntry,CanvasBlendMode,CanvasControlLayerContract,CanvasDocumentContractV3,@@ -252,6 +253,25 @@ export const createReferenceImageId = (): string =>export const createAdjustmentId = (): string =>`adj-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;+/** A fresh adjustment entry of `type` at its identity values (invert has none). */+export const createIdentityAdjustment = (type: CanvasAdjustmentEntry['type']): CanvasAdjustmentEntry => {+ const id = createAdjustmentId();+ switch (type) {+ case 'brightness-contrast':+ return { brightness: 0, contrast: 0, id, isEnabled: true, type };+ case 'levels':+ return { gamma: 1, id, inBlack: 0, inWhite: 255, isEnabled: true, outBlack: 0, outWhite: 255, type };+ case 'curves':+ return { curves: {}, id, isEnabled: true, type };+ case 'hsl':+ return { id, isEnabled: true, saturation: 0, type };+ case 'hue':+ return { id, isEnabled: true, rotation: 0, type };+ case 'invert':+ return { id, isEnabled: true, type };+ }+};+/*** A fresh regional reference image, minting the config kind the region's base can* actually consume: FLUX regions use FLUX Redux (the only kind resolved for FLUXdiff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsxindex 32dc2799a0..becc78a8a6 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx@@ -10,6 +10,7 @@ import { ControlLayerSettings } from '@workbench/widgets/layers/ControlLayerSettimport { InpaintMaskSettings } from '@workbench/widgets/layers/InpaintMaskSettings';import {adjustmentChildKind,+ childRowNameKey,MASK_DENOISE_ITEM_ID,MASK_NOISE_ITEM_ID,type LayerChildRowKind,@@ -104,13 +105,8 @@ const resolveChildEditor = (if (layer.type === 'raster') {const entry = layer.adjustments?.find((candidate) => candidate.id === selection.itemId);if (entry) {- const subtitle =- entry.type === 'brightness-contrast'- ? t('widgets.layers.modifiers.brightnessContrast')- : entry.type === 'hsl'- ? t('widgets.layers.adjustments.saturation')- : t('widgets.layers.adjustments.curves');- return { itemId: selection.itemId, kind: adjustmentChildKind(entry.type), subtitle };+ const kind = adjustmentChildKind(entry.type);+ return { itemId: selection.itemId, kind, subtitle: t(childRowNameKey(kind)) };}}return null;