Android不尊重颜色!

Tom*_*rez 6 android bitmap

试图调整存储在我的SD卡上的图像的大小,我注意到原始颜色在哪里被改变了.它接缝BitmapFactory.decodeFile对此负责.这是一个演示代码:

private void testImage() throws Exception{
    BitmapFactory.Options o = new BitmapFactory.Options();
    o.inDither = false;
    o.inPreferredConfig = Bitmap.Config.ARGB_8888;
    o.inScaled = false;
    Bitmap b = BitmapFactory.decodeFile("/sdcard/test/original.jpg", o);
    b.compress(Bitmap.CompressFormat.JPEG, 100, new FileOutputStream("/sdcard/test/result.jpg"));
    b.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream("/sdcard/test/result.png"));
}
Run Code Online (Sandbox Code Playgroud)

结果图像(original.jpg,result.jpg,result.png):

替代文字替代文字替代文字

你有没有看到,男孩的皮肤在2张图片上有点绿.解决这个问题的任何提示?

小智 1

你怎么知道你原来的颜色不是绿色的?

您的相机/电脑可能已正确显示图片,因为它们正确应用了相机的颜色配置文件。你的代码显然没有。

问题可能在那里吗?尝试在相机/电脑以外的其他设备上查看图片。