Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImage looks different when used in iOS

I am having problems with a png image, that gets wrong colors on iOS compared to the actual image.

It does not matter how I am using the image, it always gets the wrong colors. I have tried on UIButton and UIImageView and it gives the same result.

It is a very standard use of a UIImage:

UIImage* greenButtonImg = [UIImage imageNamed:@"btn_green"];
UIImageView* testView = [[UIImageView alloc] initWithImage:greenButtonImg];
[self.view addSubview:testView];

The second image is how it looks on iOS and the first button is how it looks on my Mac (Finder and Photoshop):

First button is as the image looks on the Mac, second image is as the image look on iOS

As you can see the second button has a different green color. This is happening all over the app where am using this picture. It happens in the Simulator and on a iPhone 5.

What can cause this issue? Can this be caused by settings in Photoshop, where the image was created?

like image 474
ThomasCle Avatar asked Oct 03 '22 16:10

ThomasCle


1 Answers

As Jeff wrote in a comment it was a problem with the RGB Profiles.

I managed to fix the problem by converting the color profile in Photoshop:

Edit -> Convert to Profile... -> Set profile to "Apple RGB"

like image 134
ThomasCle Avatar answered Oct 07 '22 20:10

ThomasCle