public static final BufferedImage filterImage(BufferedImage img, Color c) {

        BufferedImage imgClone = deepCopy(img);

        float cHSB[] = new float[3];
        WritableRaster trame = img.getRaster();
        WritableRaster trameClone = imgClone.getRaster();
        ColorModel model = img.getColorModel();
        float[] hsb = new float[3];
        Object data;
        int w = img.getWidth();
        int h = img.getHeight();

        for (int x = 0; x < w; x++) {
            for (int y = 0; y < h; y++) {
                data = trame.getDataElements(x, y, null);
                boolean pink = false;
                if (model.getRed(data) == 255 && model.getGreen(data) == 0 && model.getBlue(data) == 255) {
                    pink = true;
                }

                Color.RGBtoHSB(model.getRed(data), model.getGreen(data), model.getBlue(data), hsb);
                if (pink) {
                    trameClone.setDataElements(x, y, model.getDataElements(0x00FFFFFF & Color.HSBtoRGB(1 - cHSB[0], 0, hsb[2]), null));
                } else {
                    trameClone.setDataElements(x, y, model.getDataElements(c.getRGB() & model.getRGB(data), null));
                }
            }
        }
        
        return imgClone;

    }