
I did a couple of nice changes to the Java function I posted before to swap colors in a previously loaded BufferedImage, including variable saturation and brightness to ensure full ninja goodness! =D
Here we go:
void colorearNinja(BufferedImage image,int n_hue,float sat,float val) {
int c,r,g,b;
int w = image.getWidth(this);
int h = image.getHeight(this);
float hue = n_hue / 360f;
float hsb[] = new float[3];
for(int j = 0; j < h; j++)
for(int i = 0; i < w; i++) {
c = image.getRGB(i,j);
b = c & 255;
g = (c » 8) & 255;
r = (c » 16) & 255;
if(r <= g) {
Color.RGBtoHSB(r,g,b,hsb);
hsb[1] *= sat;
hsb[2] *= val;
image.setRGB(i,j,Color.HSBtoRGB(hue,hsb[1],hsb[2]));
}
}
}
Now the function works with a Sub-Zero sprite sheet. Sub-Zero is a very interesting character here because of his color combination: dark grays, blues and oranges for the skin.

In a color wheel, blue is exactly opposite orange, which means they are like totally different colors. So this time we are looking for blueish pixels (the ninja suit), while ignoring anything orange enough to pass like flesh.
With a given hue of 50°, we get all that boring blue replaced by Glorious Yellow:

And by toying a little more with the function we get a bunch of extra ninjas:
colorearNinja(image,50,1,1); // Scorpion
colorearNinja(image,0,1,1); // Ermac (0° means red)
colorearNinja(image,120,1,0.8f); // Reptile (less brightness for darker green)
colorearNinja(image,0,0,0.8f); // Smoke (no saturation for graying out)
colorearNinja(image,320,1,0.8f); // Rain (totally fabulous values!)

Noob Saibot is a special case but not a difficult one. I’ll take care of him later,
I guess.

