Color Matrix

Apply filters to colors to simulate things like color blindness and night vision.

This project is maintained by skratchdot

Color Matrix Examples

normal matrix saturate hueRotate luminanceToAlpha invert grayscale sepia nightvision warm cool brightness exposure contrast temperature tint threshold protanomaly deuteranomaly tritanomaly protanopia deuteranopia tritanopia achromatopsia achromatomaly

normal

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "normal");
// or
matrix.normal([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "normal" "#FF0080" 
# or process an image:
color-matrix --filter "normal" --input ./image.png --output ./image-normal.png

Example Results

Original Color Matrix SVG
normal normal

matrix

with value: 1,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,0,0,0,0,1,0

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "matrix", 1,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,0,0,0,0,1,0);
// or
matrix.matrix([255, 0, 128, 255], 1,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,0,0,0,0,1,0);

CLI Usage:

color-matrix --filter "matrix" "#FF0080" --value 1,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,0,0,0,0,1,0
# or process an image:
color-matrix --filter "matrix" --input ./image.png --output ./image-matrix-1,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,0,0,0,0,1,0.png --value 1,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,0,0,0,0,1,0

Example Results

Original Color Matrix SVG
matrix matrix

saturate

with value: 0

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "saturate", 0);
// or
matrix.saturate([255, 0, 128, 255], 0);

CLI Usage:

color-matrix --filter "saturate" "#FF0080" --value 0
# or process an image:
color-matrix --filter "saturate" --input ./image.png --output ./image-saturate-0.png --value 0

Example Results

Original Color Matrix SVG
saturate saturate

with value: 0.3

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "saturate", 0.3);
// or
matrix.saturate([255, 0, 128, 255], 0.3);

CLI Usage:

color-matrix --filter "saturate" "#FF0080" --value 0.3
# or process an image:
color-matrix --filter "saturate" --input ./image.png --output ./image-saturate-0.3.png --value 0.3

Example Results

Original Color Matrix SVG
saturate saturate

with value: 0.5

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "saturate", 0.5);
// or
matrix.saturate([255, 0, 128, 255], 0.5);

CLI Usage:

color-matrix --filter "saturate" "#FF0080" --value 0.5
# or process an image:
color-matrix --filter "saturate" --input ./image.png --output ./image-saturate-0.5.png --value 0.5

Example Results

Original Color Matrix SVG
saturate saturate

with value: 0.7

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "saturate", 0.7);
// or
matrix.saturate([255, 0, 128, 255], 0.7);

CLI Usage:

color-matrix --filter "saturate" "#FF0080" --value 0.7
# or process an image:
color-matrix --filter "saturate" --input ./image.png --output ./image-saturate-0.7.png --value 0.7

Example Results

Original Color Matrix SVG
saturate saturate

with value: 1

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "saturate", 1);
// or
matrix.saturate([255, 0, 128, 255], 1);

CLI Usage:

color-matrix --filter "saturate" "#FF0080" --value 1
# or process an image:
color-matrix --filter "saturate" --input ./image.png --output ./image-saturate-1.png --value 1

Example Results

Original Color Matrix SVG
saturate saturate

hueRotate

with value: 0

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "hueRotate", 0);
// or
matrix.hueRotate([255, 0, 128, 255], 0);

CLI Usage:

color-matrix --filter "hueRotate" "#FF0080" --value 0
# or process an image:
color-matrix --filter "hueRotate" --input ./image.png --output ./image-hueRotate-0.png --value 0

Example Results

Original Color Matrix SVG
hueRotate hueRotate

with value: 45

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "hueRotate", 45);
// or
matrix.hueRotate([255, 0, 128, 255], 45);

CLI Usage:

color-matrix --filter "hueRotate" "#FF0080" --value 45
# or process an image:
color-matrix --filter "hueRotate" --input ./image.png --output ./image-hueRotate-45.png --value 45

Example Results

Original Color Matrix SVG
hueRotate hueRotate

with value: 90

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "hueRotate", 90);
// or
matrix.hueRotate([255, 0, 128, 255], 90);

CLI Usage:

color-matrix --filter "hueRotate" "#FF0080" --value 90
# or process an image:
color-matrix --filter "hueRotate" --input ./image.png --output ./image-hueRotate-90.png --value 90

Example Results

Original Color Matrix SVG
hueRotate hueRotate

with value: 135

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "hueRotate", 135);
// or
matrix.hueRotate([255, 0, 128, 255], 135);

CLI Usage:

color-matrix --filter "hueRotate" "#FF0080" --value 135
# or process an image:
color-matrix --filter "hueRotate" --input ./image.png --output ./image-hueRotate-135.png --value 135

Example Results

Original Color Matrix SVG
hueRotate hueRotate

with value: 180

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "hueRotate", 180);
// or
matrix.hueRotate([255, 0, 128, 255], 180);

CLI Usage:

color-matrix --filter "hueRotate" "#FF0080" --value 180
# or process an image:
color-matrix --filter "hueRotate" --input ./image.png --output ./image-hueRotate-180.png --value 180

Example Results

Original Color Matrix SVG
hueRotate hueRotate

with value: 225

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "hueRotate", 225);
// or
matrix.hueRotate([255, 0, 128, 255], 225);

CLI Usage:

color-matrix --filter "hueRotate" "#FF0080" --value 225
# or process an image:
color-matrix --filter "hueRotate" --input ./image.png --output ./image-hueRotate-225.png --value 225

Example Results

Original Color Matrix SVG
hueRotate hueRotate

with value: 270

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "hueRotate", 270);
// or
matrix.hueRotate([255, 0, 128, 255], 270);

CLI Usage:

color-matrix --filter "hueRotate" "#FF0080" --value 270
# or process an image:
color-matrix --filter "hueRotate" --input ./image.png --output ./image-hueRotate-270.png --value 270

Example Results

Original Color Matrix SVG
hueRotate hueRotate

with value: 315

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "hueRotate", 315);
// or
matrix.hueRotate([255, 0, 128, 255], 315);

CLI Usage:

color-matrix --filter "hueRotate" "#FF0080" --value 315
# or process an image:
color-matrix --filter "hueRotate" --input ./image.png --output ./image-hueRotate-315.png --value 315

Example Results

Original Color Matrix SVG
hueRotate hueRotate

luminanceToAlpha

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "luminanceToAlpha");
// or
matrix.luminanceToAlpha([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "luminanceToAlpha" "#FF0080" 
# or process an image:
color-matrix --filter "luminanceToAlpha" --input ./image.png --output ./image-luminanceToAlpha.png

Example Results

Original Color Matrix SVG
luminanceToAlpha luminanceToAlpha

invert

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "invert");
// or
matrix.invert([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "invert" "#FF0080" 
# or process an image:
color-matrix --filter "invert" --input ./image.png --output ./image-invert.png

Example Results

Original Color Matrix SVG
invert invert

grayscale

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "grayscale");
// or
matrix.grayscale([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "grayscale" "#FF0080" 
# or process an image:
color-matrix --filter "grayscale" --input ./image.png --output ./image-grayscale.png

Example Results

Original Color Matrix SVG
grayscale grayscale

sepia

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "sepia");
// or
matrix.sepia([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "sepia" "#FF0080" 
# or process an image:
color-matrix --filter "sepia" --input ./image.png --output ./image-sepia.png

Example Results

Original Color Matrix SVG
sepia sepia

nightvision

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "nightvision");
// or
matrix.nightvision([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "nightvision" "#FF0080" 
# or process an image:
color-matrix --filter "nightvision" --input ./image.png --output ./image-nightvision.png

Example Results

Original Color Matrix SVG
nightvision nightvision

warm

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "warm");
// or
matrix.warm([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "warm" "#FF0080" 
# or process an image:
color-matrix --filter "warm" --input ./image.png --output ./image-warm.png

Example Results

Original Color Matrix SVG
warm warm

cool

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "cool");
// or
matrix.cool([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "cool" "#FF0080" 
# or process an image:
color-matrix --filter "cool" --input ./image.png --output ./image-cool.png

Example Results

Original Color Matrix SVG
cool cool

brightness

with value: -100

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "brightness", -100);
// or
matrix.brightness([255, 0, 128, 255], -100);

CLI Usage:

color-matrix --filter "brightness" "#FF0080" --value -100
# or process an image:
color-matrix --filter "brightness" --input ./image.png --output ./image-brightness--100.png --value -100

Example Results

Original Color Matrix SVG
brightness brightness

with value: -50

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "brightness", -50);
// or
matrix.brightness([255, 0, 128, 255], -50);

CLI Usage:

color-matrix --filter "brightness" "#FF0080" --value -50
# or process an image:
color-matrix --filter "brightness" --input ./image.png --output ./image-brightness--50.png --value -50

Example Results

Original Color Matrix SVG
brightness brightness

with value: -25

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "brightness", -25);
// or
matrix.brightness([255, 0, 128, 255], -25);

CLI Usage:

color-matrix --filter "brightness" "#FF0080" --value -25
# or process an image:
color-matrix --filter "brightness" --input ./image.png --output ./image-brightness--25.png --value -25

Example Results

Original Color Matrix SVG
brightness brightness

with value: 0

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "brightness", 0);
// or
matrix.brightness([255, 0, 128, 255], 0);

CLI Usage:

color-matrix --filter "brightness" "#FF0080" --value 0
# or process an image:
color-matrix --filter "brightness" --input ./image.png --output ./image-brightness-0.png --value 0

Example Results

Original Color Matrix SVG
brightness brightness

with value: 25

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "brightness", 25);
// or
matrix.brightness([255, 0, 128, 255], 25);

CLI Usage:

color-matrix --filter "brightness" "#FF0080" --value 25
# or process an image:
color-matrix --filter "brightness" --input ./image.png --output ./image-brightness-25.png --value 25

Example Results

Original Color Matrix SVG
brightness brightness

with value: 50

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "brightness", 50);
// or
matrix.brightness([255, 0, 128, 255], 50);

CLI Usage:

color-matrix --filter "brightness" "#FF0080" --value 50
# or process an image:
color-matrix --filter "brightness" --input ./image.png --output ./image-brightness-50.png --value 50

Example Results

Original Color Matrix SVG
brightness brightness

with value: 100

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "brightness", 100);
// or
matrix.brightness([255, 0, 128, 255], 100);

CLI Usage:

color-matrix --filter "brightness" "#FF0080" --value 100
# or process an image:
color-matrix --filter "brightness" --input ./image.png --output ./image-brightness-100.png --value 100

Example Results

Original Color Matrix SVG
brightness brightness

exposure

with value: -0.5

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "exposure", -0.5);
// or
matrix.exposure([255, 0, 128, 255], -0.5);

CLI Usage:

color-matrix --filter "exposure" "#FF0080" --value -0.5
# or process an image:
color-matrix --filter "exposure" --input ./image.png --output ./image-exposure--0.5.png --value -0.5

Example Results

Original Color Matrix SVG
exposure exposure

with value: 1

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "exposure", 1);
// or
matrix.exposure([255, 0, 128, 255], 1);

CLI Usage:

color-matrix --filter "exposure" "#FF0080" --value 1
# or process an image:
color-matrix --filter "exposure" --input ./image.png --output ./image-exposure-1.png --value 1

Example Results

Original Color Matrix SVG
exposure exposure

with value: 2

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "exposure", 2);
// or
matrix.exposure([255, 0, 128, 255], 2);

CLI Usage:

color-matrix --filter "exposure" "#FF0080" --value 2
# or process an image:
color-matrix --filter "exposure" --input ./image.png --output ./image-exposure-2.png --value 2

Example Results

Original Color Matrix SVG
exposure exposure

with value: 4

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "exposure", 4);
// or
matrix.exposure([255, 0, 128, 255], 4);

CLI Usage:

color-matrix --filter "exposure" "#FF0080" --value 4
# or process an image:
color-matrix --filter "exposure" --input ./image.png --output ./image-exposure-4.png --value 4

Example Results

Original Color Matrix SVG
exposure exposure

contrast

with value: 0

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "contrast", 0);
// or
matrix.contrast([255, 0, 128, 255], 0);

CLI Usage:

color-matrix --filter "contrast" "#FF0080" --value 0
# or process an image:
color-matrix --filter "contrast" --input ./image.png --output ./image-contrast-0.png --value 0

Example Results

Original Color Matrix SVG
contrast contrast

with value: 0.5

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "contrast", 0.5);
// or
matrix.contrast([255, 0, 128, 255], 0.5);

CLI Usage:

color-matrix --filter "contrast" "#FF0080" --value 0.5
# or process an image:
color-matrix --filter "contrast" --input ./image.png --output ./image-contrast-0.5.png --value 0.5

Example Results

Original Color Matrix SVG
contrast contrast

with value: 1

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "contrast", 1);
// or
matrix.contrast([255, 0, 128, 255], 1);

CLI Usage:

color-matrix --filter "contrast" "#FF0080" --value 1
# or process an image:
color-matrix --filter "contrast" --input ./image.png --output ./image-contrast-1.png --value 1

Example Results

Original Color Matrix SVG
contrast contrast

temperature

with value: 0

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "temperature", 0);
// or
matrix.temperature([255, 0, 128, 255], 0);

CLI Usage:

color-matrix --filter "temperature" "#FF0080" --value 0
# or process an image:
color-matrix --filter "temperature" --input ./image.png --output ./image-temperature-0.png --value 0

Example Results

Original Color Matrix SVG
temperature temperature

with value: 0.5

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "temperature", 0.5);
// or
matrix.temperature([255, 0, 128, 255], 0.5);

CLI Usage:

color-matrix --filter "temperature" "#FF0080" --value 0.5
# or process an image:
color-matrix --filter "temperature" --input ./image.png --output ./image-temperature-0.5.png --value 0.5

Example Results

Original Color Matrix SVG
temperature temperature

with value: 1

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "temperature", 1);
// or
matrix.temperature([255, 0, 128, 255], 1);

CLI Usage:

color-matrix --filter "temperature" "#FF0080" --value 1
# or process an image:
color-matrix --filter "temperature" --input ./image.png --output ./image-temperature-1.png --value 1

Example Results

Original Color Matrix SVG
temperature temperature

tint

with value: 0

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "tint", 0);
// or
matrix.tint([255, 0, 128, 255], 0);

CLI Usage:

color-matrix --filter "tint" "#FF0080" --value 0
# or process an image:
color-matrix --filter "tint" --input ./image.png --output ./image-tint-0.png --value 0

Example Results

Original Color Matrix SVG
tint tint

with value: 0.5

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "tint", 0.5);
// or
matrix.tint([255, 0, 128, 255], 0.5);

CLI Usage:

color-matrix --filter "tint" "#FF0080" --value 0.5
# or process an image:
color-matrix --filter "tint" --input ./image.png --output ./image-tint-0.5.png --value 0.5

Example Results

Original Color Matrix SVG
tint tint

with value: 1

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "tint", 1);
// or
matrix.tint([255, 0, 128, 255], 1);

CLI Usage:

color-matrix --filter "tint" "#FF0080" --value 1
# or process an image:
color-matrix --filter "tint" --input ./image.png --output ./image-tint-1.png --value 1

Example Results

Original Color Matrix SVG
tint tint

threshold

with value: 0

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "threshold", 0);
// or
matrix.threshold([255, 0, 128, 255], 0);

CLI Usage:

color-matrix --filter "threshold" "#FF0080" --value 0
# or process an image:
color-matrix --filter "threshold" --input ./image.png --output ./image-threshold-0.png --value 0

Example Results

Original Color Matrix SVG
threshold threshold

with value: 1

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "threshold", 1);
// or
matrix.threshold([255, 0, 128, 255], 1);

CLI Usage:

color-matrix --filter "threshold" "#FF0080" --value 1
# or process an image:
color-matrix --filter "threshold" --input ./image.png --output ./image-threshold-1.png --value 1

Example Results

Original Color Matrix SVG
threshold threshold

with value: 2

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "threshold", 2);
// or
matrix.threshold([255, 0, 128, 255], 2);

CLI Usage:

color-matrix --filter "threshold" "#FF0080" --value 2
# or process an image:
color-matrix --filter "threshold" --input ./image.png --output ./image-threshold-2.png --value 2

Example Results

Original Color Matrix SVG
threshold threshold

protanomaly

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "protanomaly");
// or
matrix.protanomaly([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "protanomaly" "#FF0080" 
# or process an image:
color-matrix --filter "protanomaly" --input ./image.png --output ./image-protanomaly.png

Example Results

Original Color Matrix SVG
protanomaly protanomaly

deuteranomaly

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "deuteranomaly");
// or
matrix.deuteranomaly([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "deuteranomaly" "#FF0080" 
# or process an image:
color-matrix --filter "deuteranomaly" --input ./image.png --output ./image-deuteranomaly.png

Example Results

Original Color Matrix SVG
deuteranomaly deuteranomaly

tritanomaly

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "tritanomaly");
// or
matrix.tritanomaly([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "tritanomaly" "#FF0080" 
# or process an image:
color-matrix --filter "tritanomaly" --input ./image.png --output ./image-tritanomaly.png

Example Results

Original Color Matrix SVG
tritanomaly tritanomaly

protanopia

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "protanopia");
// or
matrix.protanopia([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "protanopia" "#FF0080" 
# or process an image:
color-matrix --filter "protanopia" --input ./image.png --output ./image-protanopia.png

Example Results

Original Color Matrix SVG
protanopia protanopia

deuteranopia

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "deuteranopia");
// or
matrix.deuteranopia([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "deuteranopia" "#FF0080" 
# or process an image:
color-matrix --filter "deuteranopia" --input ./image.png --output ./image-deuteranopia.png

Example Results

Original Color Matrix SVG
deuteranopia deuteranopia

tritanopia

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "tritanopia");
// or
matrix.tritanopia([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "tritanopia" "#FF0080" 
# or process an image:
color-matrix --filter "tritanopia" --input ./image.png --output ./image-tritanopia.png

Example Results

Original Color Matrix SVG
tritanopia tritanopia

achromatopsia

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "achromatopsia");
// or
matrix.achromatopsia([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "achromatopsia" "#FF0080" 
# or process an image:
color-matrix --filter "achromatopsia" --input ./image.png --output ./image-achromatopsia.png

Example Results

Original Color Matrix SVG
achromatopsia achromatopsia

achromatomaly

Node Usage:

var ColorMatrix = require("color-matrix");
var matrix = new ColorMatrix();
matrix.transform([255, 0, 128, 255], "achromatomaly");
// or
matrix.achromatomaly([255, 0, 128, 255]);

CLI Usage:

color-matrix --filter "achromatomaly" "#FF0080" 
# or process an image:
color-matrix --filter "achromatomaly" --input ./image.png --output ./image-achromatomaly.png

Example Results

Original Color Matrix SVG
achromatomaly achromatomaly