Download the PHP package itwmw/color-difference without Composer
On this page you can find all versions of the php package itwmw/color-difference. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package color-difference
A library for calculating the perceptual difference between colors (∆E).
The difference or distance between two colors is a metric of interest in color science. It allows quantified examination of a notion that formerly could only be described with adjectives. Quantification of these properties is of great importance to those whose work is color-critical. Common definitions make use of the Euclidean distance in a device independent color space.
The following measurements are supported:
- Euclidean
- Weighted Euclidean
- DIN99 (2007)
- CIE76 (1976)
- CIE94 (1994)
- CIEDE2000 (2000)
- CMC l:c (1984)
All calculations are performed in either L*a*b or L*C*H space (as the metrics prescribe).
Quick Start
This library is available on packagist, like so:
Usage
The color difference metrics are implemented via the following functions:
- Euclidean RGB
getDifferenceEuclideanRGB(Color $color): float
- Euclidean Lab
getDifferenceEuclideanLab(Color $color): float
- Weighted Euclidean RGB
getDifferenceWeightedEuclideanRGB(Color $color): float
- Din99
getDifferenceDin99(Color $color): float
- CIE76:
getDifferenceCIE76(Color $color): float
- CIE94:
getDifferenceCIE94(Color $color, CIE94 $type = CIE94::GraphicArts): float
- CIEDE2000:
getDifferenceCIEDE2000(Color $color): float
- CMC l:c:
getDifferenceCMC(Color $color, CMC $type = CMC::Imperceptibility): float
CIE94 and CMC l:c accept an optional parameter adjusting the metric for the kind of quasimetric being evaluated. CIE94 offers an application type choice of either 'graphicArts' or 'textiles' for their eponymous use. CMC l:c offers a threshold choice of either 'acceptability' or 'imperceptibility' that nuances the just-noticeable difference between the colors.
Reference White
Use referenceWhite
to specify Reference White for the Color class
Support:
- A; //Incandescent/tungsten
- B; //Old direct sunlight at noon
- C; //Old daylight
- D50; //ICC profile PCS
- D55; //Mid-morning daylight
- D65; //Daylight, sRGB, Adobe-RGB
- D75; //North sky daylight
- E; //Equal energy
- F1; //Daylight Fluorescent
- F2; //Cool fluorescent
- F3; //White Fluorescent
- F4; //Warm White Fluorescent
- F5; //Daylight Fluorescent
- F6; //Lite White Fluorescent
- F7; //Daylight fluorescent, D65 simulator
- F8; //Sylvania F40, D50 simulator
- F9; //Cool White Fluorescent
- F10; //Ultralume 50, Philips TL85
- F11; //Ultralume 40, Philips TL84
- F12; //Ultralume 30, Philips TL83
RGB Working Space
Use RGBSpace
to specify RGB Working Space for the Color class
Support:
- Adobe RGB (1998)
- AppleRGB
- Best RGB
- Beta RGB
- Bruce RGB
- CIE RGB
- ColorMatch RGB
- Don RGB 4
- ECI RGB
- Ekta Space PS5
- NTSC RGB
- PAL/SECAM RGB
- ProPhoto RGB
- SMPTE-C RGB
- sRGB
- Wide Gamut RGB
In general,
RGB Working Space
needs to correspond toReference White
.
The default is: