public class ColorUtilities
extends java.lang.Object
Various static methods helpful for color conversions.
Modifier and Type | Method and Description |
---|---|
static float[] |
getCIELabFromXYZ(float[] cieXYZ)
Convert CIEXYZ to CIE 1976 L*, a*, b*.
|
static float[] |
getCIELabPCSFromIntegerScaledCIELabPCS(int[] cieLabScaled)
Convert 16 bit fractional integer scaled CIELab values used in ICC profiles and DICOM to floating point.
|
static float[] |
getCIELabPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to CIELab in ICC PCS.
|
static float[] |
getCIEXYZFromLAB(float[] cieLab)
Convert CIE 1976 L*, a*, b* to CIEXYZ.
|
static float[] |
getCIEXYZPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to CIEXYZ in ICC PCS.
|
static int[] |
getIntegerScaledCIELabFromCIELab(float[] cieLab)
Convert floating point CIELab values to the 16 bit fractional integer scaled representation used in ICC profiles and DICOM.
|
static int[] |
getIntegerScaledCIELabPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to 16 bit fractional integer scaled CIELab in ICC PCS.
|
static int[] |
getSRGBFromCIELabPCS(float[] cieLab)
Convert CIELab in ICC PCS to RGB values in sRGB.
|
static int[] |
getSRGBFromCIEXYZPCS(float[] cieXYZ)
Convert CIEXYZ in ICC PCS to RGB values in sRGB.
|
static int[] |
getSRGBFromIntegerScaledCIELabPCS(int[] cieLabScaled)
Convert 16 bit fractional integer scaled CIELab in ICC PCS to RGB values in sRGB.
|
static void |
main(java.lang.String[] arg)
Convert color values
|
public static float[] getCIELabFromXYZ(float[] cieXYZ)
Convert CIEXYZ to CIE 1976 L*, a*, b*.
cieXYZ
- array of length 3 containing X,Y,Z values
return array of length 3 containing L*,a*,b* valuespublic static float[] getCIELabPCSFromIntegerScaledCIELabPCS(int[] cieLabScaled)
Convert 16 bit fractional integer scaled CIELab values used in ICC profiles and DICOM to floating point.
See ICC v4.3 Tables 12 and 13, and DICOM PS 3.3 C.10.7.1.1.
cieLabScaled
- array of length 3 containing 16 bit scaled L*,a*,b* values from 0 to 65535
return array of length 3 containing L*,a*,b* values with L* from 0.0 to 100.0, and a* and b* from -128.0 to +127.0public static float[] getCIELabPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to CIELab in ICC PCS.
rgb
- array of length 3 containing R,G,B values each from 0 to 255
return array of length 3 containing L*,a*,b* valuespublic static float[] getCIEXYZFromLAB(float[] cieLab)
Convert CIE 1976 L*, a*, b* to CIEXYZ.
cieLab
- array of length 3 containing L*,a*,b* values
return array of length 3 containing X,Y,Z valuespublic static float[] getCIEXYZPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to CIEXYZ in ICC PCS.
SRGB Observer = 2°, Illuminant = D65, XYZ PCS Illuminant = D50.
rgb
- array of length 3 containing R,G,B values each from 0 to 255
return array of length 3 containing X,Y,Z valuespublic static int[] getIntegerScaledCIELabFromCIELab(float[] cieLab)
Convert floating point CIELab values to the 16 bit fractional integer scaled representation used in ICC profiles and DICOM.
See ICC v4.3 Tables 12 and 13, and DICOM PS 3.3 C.10.7.1.1.
cieLab
- array of length 3 containing L*,a*,b* values with L* from 0.0 to 100.0, and a* and b* from -128.0 to +127.0
return array of length 3 containing 16 bit scaled L*,a*,b* values from 0 to 65535public static int[] getIntegerScaledCIELabPCSFromSRGB(int[] rgb)
Convert RGB values in sRGB to 16 bit fractional integer scaled CIELab in ICC PCS.
rgb
- array of length 3 containing R,G,B values each from 0 to 255
return array of length 3 containing L*,a*,b* values each from 0 to 65535public static int[] getSRGBFromCIELabPCS(float[] cieLab)
Convert CIELab in ICC PCS to RGB values in sRGB.
cieLab
- array of length 3 containing L*,a*,b* values
return array of length 3 containing R,G,B values each from 0 to 255public static int[] getSRGBFromCIEXYZPCS(float[] cieXYZ)
Convert CIEXYZ in ICC PCS to RGB values in sRGB.
SRGB Observer = 2°, Illuminant = D65, XYZ PCS Illuminant = D50.
cieXYZ
- array of length 3 containing X,Y,Z values
return array of length 3 containing R,G,B values each from 0 to 255public static int[] getSRGBFromIntegerScaledCIELabPCS(int[] cieLabScaled)
Convert 16 bit fractional integer scaled CIELab in ICC PCS to RGB values in sRGB.
cieLabScaled
- array of length 3 containing L*,a*,b* values each from 0 to 65535
return array of length 3 containing R,G,B values each from 0 to 255public static void main(java.lang.String[] arg)
Convert color values
arg
- sRGB8toCIELab16 or CIELab16tosRGB8 (case insensitive) and three color values (each decimal or 0xhex)