Asymptote
Asymptote

Reputation: 1150

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

Upvotes: 3

Views: 583

Answers (1)

Jon Purdy
Jon Purdy

Reputation: 54999

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.

Upvotes: 2

Related Questions