Hue-Preserving Color Blending
Additional Results
Johnson Chuang, Daniel Weiskopf, Torsten Möller
Additional image comparisons from blending in different color spaces:
| Traditional blending | Hue-preserving blending in HSL | Hue-preserving blending in LCH (i.e. CIELAB) | Hue-preserving blending in CIE XYZ | |
| Tomato |
![]()
|
|
![]()
|
![]()
|
| Tooth |
![]()
|
![]()
|
![]()
|
![]()
|
| Frog |
![]()
|
![]()
|
![]()
|
![]()
|
| Engine |
![]()
|
![]()
|
![]()
|
![]()
|
Blending two RGB colors C1 and C2 in HSL:
HSLtrad = rgb2hsl(C1 + C2)
HSL1 = rgb2hsl(C1)
HSL2 = rgb2hsl(C2)
if(sameHue(H1, H2)) then
Cnew = C1 + C2
else
if(S1 > S2) then // C1 is
dominant
H3 = H1 + 180
S3 = S2
L3 = L2
Cnew = C1 + hsl2rgb(H3, S3, L3)
else // C2 is dominant
H3 = H2 + 180
S3 = S1
L3 = L1
Cnew = hsl2rgb(H3, S3, L3) + C2
endif
endif
Blending two RGB colors C1 and C2 in LCH:
LCHtrad = rgb2lch(C1 + C2)
LCH1 = rgb2lch(C1)
LCH2 = rgb2lch(C2)
if(sameHue(H1, H2)) then
Cnew = C1 + C2
else
if(C1 > C2) then // C1 is dominant
C3 = C1-C2
H3 = H1
else // C2 is dominant
C3 = C2-C1
H3 = H2
endif
Cnew = lch2rgb(Ltrad, C3, H3)
endif
Blending two RGB colors C1 and C2 in XYZ:
HSLtrad = rgb2hsl(C1 + C2)
XYZ1 = rgb2xyz(C1)
XYZ2 = rgb2xyz(C2)
HSL1 = rgb2hsl(C1)
HSL2 = rgb2hsl(C2)
if(sameHue(H1, H2)) then
Cnew = C1 + C2
else
if(H1 closer to Htrad) then // C1 is
dominant
XYZnew = XYZ1 + rgb2xyz(hsl2rgb(H1 +
180, S2, L2))
else // H2 closer to Htrad, and C2
is dominant
XYZnew = XYZ2 + rgb2xyz(hsl2rgb(H2 +
180, S1, L1))
endif
Cnew = xyz2rgb(XYZnew)
endif
Optional: For all the above blending methods, the luminance of the final blended color can be made equal to the luminance of the traditionally-blended color by doing the following computations in CIELAB.
L*A*B*trad = rgb2lab(C1 + C2)
L*A*B*new = rgb2lab(Cnew)
Cnew = lab2rgb(L*trad, Anew, Bnew)
Last updated: July 27, 2009