简体   繁体   中英

Android: Wrong RGB values in Bitmap

I have created a png in gimp and I am reading it as bitmap in Android. When I deploy the app on Galaxy Tab 10.1 ( ICS ) I get the right rgb values, but in emulator and on Xperia Arc ( Android 2.3.3 ) I get slightly different rgb values.

For Example I set a pixel value to (255, 255, 200) in gimp and export png. When I create a bitmap from resource (while using emulator/Xperia Arc using 2.3.3) I get values (255, 255, 206), while on Galaxy Tab/emulator (using 4.0 (ICS)) I get the right values (255, 255, 200)

I am not sure why is that. Can show you guys the code if it helps. Thanks

It looks like the emulator is performing gamma correction. Monitors typically have a gamma value of around 1.2. Any RGB channel value you send to the monitor (0.0–1.0) will be raised to that exponent before display. The emulator appears to be using a gamma of around 0.87 to compensate. Although the values will differ, colours on the emulator will more closely match those on the device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM