/*
 * http://blog.csdn.net/the3gwireless
 * 调节图像明暗的方法,start和 end 的值 在0-255之间,
 * 比如,0-16就会让图像变得很暗,0-255保持不变
 */
public static Image lightenessRGB(Image image, int start, int end) {
    // System.out.println("reverseRGB IN");
    int width = image.getWidth();
    int height = image.getHeight();
    // 获得图像的ARGB数据,存储在rawInt里
    int[] raw = null;
    try {
        raw = new int[width * height];
        image.getRGB(raw, 0, width, 0, 0, width, height);
        int len = raw.length;
        // 开始循环,获得图像里每个像素的颜色,然后处理
        for (int i = 0; i < len; i++) {
            // 获得像素的颜色
            int color = raw[i];
            // System.out.println(Integer.toHexString(color));
            // 获得alpha
            int alpha = 0xFF;
            // System.out.println(Integer.toHexString(alpha));
            // 获得红色
            int red = (color & 0x00FF0000) >> 16;
            // System.out.println(Integer.toHexString(red));
            // 获得绿色
            int green = (color & 0x0000FF00) >> 8;
            // System.out.println(Integer.toHexString(green));
            // 获得蓝色
            int blue = (color & 0x000000FF);
            // System.out.println(Integer.toHexString(blue));
            // 网上找到的算法
            // 生成新颜色
            red = start + end * red / 255;
            green = start + end * green / 255;
            blue = start + end * blue / 255;
            // 生成新颜色
            // System.out.println(Integer.toHexString((alpha << 24)+ (red <<
            // 16)+(green << 8)));
            color = (alpha << 24) + (red << 16) + (green << 8) + blue;
            raw[i] = color;
        }
        // System.out.println("blendRGB OUT");
        return Image.createRGBImage(raw, width, height, true);

    } catch (Error e) {
        // e.printStackTrace();
        ImageAlbum.showAlert("图像尺寸太大,不能完成此操作.");
        return image;
    } catch (Exception e) {
        e.printStackTrace();
        return image;
    } finally {
        raw = null;
    }
}