Archived:Incorrect RGB values for JPG images on Series 40 3rd Edition (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The RGB values of the pixels in a JPG image on Series 40 3rd Edition devices may be altered from the values in the original images.

Article Metadata
Tested with
Devices(s): Nokia 5300, Nokia 6270
Created: User:Technical writer 1 (04 Jun 2007)
Last edited: hamishwillee (16 Aug 2013)


The RGB values of the pixels may be altered to differ from the values in the original images. For example, when you load an image which has only one color: RGB 255,254,128 and the RGB values from the image object are read after loading it in the MIDlet, they have been altered to 255,255,109. The problem is only limited to JPG images, the problem does not occur in PNG images.

How to reproduce

The following code sample should print "ARGB:255,255,254,128" but prints "ARGB:255,255,255,109":

img= Image.createImage("/yellow.jpg");
in>t[] srcpixels=new int[1];
img.getRGB(srcpixels, 0,1,0,0,1,1);
System.out.println("ARGB:"+((srcpixels[0] >> 24) & 0xFF) + "," + ((srcpixels[0] >> 16) & 0xFF)+ "," + ((srcpixels[0] >> 8) & 0xFF) + "," + ((srcpixels[0] >> 0) & 0xFF));
This page was last modified on 16 August 2013, at 04:22.
31 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.