This is a library to simulate and correct images for Processing Org
You can find the full source for the library here!
Start with importing the library to your code
import colorblindness.colorblindness;
import processing.glu.*;
import processing.glu.tessellator.*;
The "colorblindness.simulate() takes 4 parameters
- Type of colorblindness
- Absolute address of input file
- Absolute Address of output file
- Simulate or Correct the image
colorblindness.simulate(int type, string inputAddress, string outputAddress, boolean correct);
//For example, the following line simulates the image at /Desktop/input.jpg
//as per protanopia and stores the output at /Desktop/output.jpg
colorblindness.simulate(1,"/Desktop/input.jpg","/Desktop/output.jpg",false);
Options for type - 1 -> Protanopia 2 -> Deutranopia 3 -> Tritanopia
There are two possible function calls for this
colorblindness.rgbContrast(string inputFile, string outputFile, float factor);
//The factor range from 0 to 1
colorblindness.rgbContrast(string inputFile, string outputFile);
When no factor is defined, the library uses predetermined optimum factor of 0.28