I am creating a game which uses some jpg images. When running the game on the Nokia S40 SDK 3rd Ed FP 2, the images are not displayed correctly. This made me run some tests and I discovered that the rgb values of the pixels are altered to differ from the values in the original images.
For example I load an image which only has one color: rgb 254,128,67. When grabbing the rgb values from the image object after loading it in the midlet, they have been altered to 255,125,60! Similar alterations happen to all the jpg images I've tested and I have tried with a number of different jpg settings for compression and other. The problem is the same on the real device Nokia 5300 as in the emulator. Everything works fine on phones and emulators from other brands however. Also note that png images are handled correctly, the problem is only for jpgs.
Has anyone experienced the same problem and has any suggestion for a workaround for this? I need the images to have their correct, original rgb values since I am drawing them together with png images.
Below is a code sample that should print "ARGB:255,254,128,67" but prints "ARGB:255,255,125,50" ...
Image img = Image.createImage("/test.jpg");
int srcpixels=new int;
System.out.println("ARGB:"+((srcpixels >> 24) & 0xFF) + "," + ((srcpixels >> 16) & 0xFF)+ "," + ((srcpixels >> 8) & 0xFF) + "," + ((srcpixels >> 0) & 0xFF));