A WILD Eladio Appeared…!
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.
Ahhh… Palette Swaps.
I’m leaving some Java snippet below. It takes an image containing red pixels (e.g., Ermac’s sprite sheet) and adjusts the hues of these pixels to match the given one.
void colorear(BufferedImage image,int n_hue) {
int c,r,g,b;
int w = image.getWidth();
int h = image.getHeight();
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 > 0 && g == 0 && b == 0) {
Color.RGBtoHSB(r,g,b,hsb);
image.setRGB(i,j,Color.HSBtoRGB(hue,hsb[1],hsb[2]));
}
}
}

![Ahhh… Palette Swaps.
I’m leaving some Java snippet below. It takes an image containing red pixels (e.g., Ermac’s sprite sheet) and adjusts the hues of these pixels to match the given one.
void colorear(BufferedImage image,int n_hue) { int c,r,g,b; int w = image.getWidth(); int h = image.getHeight(); 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 > 0 && g == 0 && b == 0) { Color.RGBtoHSB(r,g,b,hsb); image.setRGB(i,j,Color.HSBtoRGB(hue,hsb[1],hsb[2])); } }}
To Part II ->](http://24.media.tumblr.com/tumblr_lhanhsZJIX1qb1wcuo1_500.png)
