Skip to content

Commit 358cc03

Browse files
dunkeronipsychedelicious
authored andcommitted
(chore) cleanup and schema
1 parent 417e6eb commit 358cc03

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

invokeai/app/invocations/image.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,21 +689,20 @@ def _match_histogram_channel(self, source: numpy.ndarray, reference: numpy.ndarr
689689
def invoke(self, context: InvocationContext) -> ImageOutput:
690690
# Load images as RGBA
691691
base_image = context.images.get_pil(self.base_image.image_name, "RGBA")
692-
color_reference = context.images.get_pil(self.color_reference.image_name, "RGBA")
693692

694693
# Store original alpha channel
695694
original_alpha = base_image.getchannel("A")
696695

697696
# Convert to working colorspace
698697
if self.colorspace == "RGB":
699-
# Work directly in RGB
700698
base_array = numpy.asarray(base_image.convert("RGB"), dtype=numpy.uint8)
701-
ref_array = numpy.asarray(color_reference.convert("RGB"), dtype=numpy.uint8)
699+
ref_rgb = context.images.get_pil(self.color_reference.image_name, "RGB")
700+
ref_array = numpy.asarray(ref_rgb, dtype=numpy.uint8)
702701
channels_to_match = [0, 1, 2] # R, G, B
703702
else:
704703
# Convert to YCbCr colorspace
705704
base_ycbcr = base_image.convert("YCbCr")
706-
ref_ycbcr = color_reference.convert("YCbCr")
705+
ref_ycbcr = context.images.get_pil(self.color_reference.image_name, "YCbCr")
707706

708707
base_array = numpy.asarray(base_ycbcr, dtype=numpy.uint8)
709708
ref_array = numpy.asarray(ref_ycbcr, dtype=numpy.uint8)

invokeai/frontend/web/src/services/api/schema.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4776,8 +4776,8 @@ export type components = {
47764776
};
47774777
/**
47784778
* Color Correct
4779-
* @description Shifts the colors of a target image to match the reference image, optionally
4780-
* using a mask to only color-correct certain regions of the target image.
4779+
* @description Matches the color histogram of a base image to a reference image, optionally
4780+
* using a mask to only color-correct certain regions of the base image.
47814781
*/
47824782
ColorCorrectInvocation: {
47834783
/**
@@ -4811,23 +4811,24 @@ export type components = {
48114811
* @description The image to color-correct
48124812
* @default null
48134813
*/
4814-
image?: components["schemas"]["ImageField"] | null;
4814+
base_image?: components["schemas"]["ImageField"] | null;
48154815
/**
48164816
* @description Reference image for color-correction
48174817
* @default null
48184818
*/
4819-
reference?: components["schemas"]["ImageField"] | null;
4819+
color_reference?: components["schemas"]["ImageField"] | null;
48204820
/**
4821-
* @description Mask to use when applying color-correction
4821+
* @description Optional mask to limit color correction area
48224822
* @default null
48234823
*/
48244824
mask?: components["schemas"]["ImageField"] | null;
48254825
/**
4826-
* Mask Blur Radius
4827-
* @description Mask blur radius
4828-
* @default 8
4826+
* Colorspace
4827+
* @description Colorspace in which to apply histogram matching
4828+
* @default RGB
4829+
* @enum {string}
48294830
*/
4830-
mask_blur_radius?: number;
4831+
colorspace?: "RGB" | "YCbCr" | "YCbCr-Chroma" | "YCbCr-Luma";
48314832
/**
48324833
* type
48334834
* @default color_correct

0 commit comments

Comments
 (0)