UIImageJPEGRepresentation Outputs an image with a purple tint

Originator:bryn.bodayle
Number:rdar://15290326 Date Originated:
Status:Open Resolved:
Product:iOS Product Version:7.0.2
Classification: Reproducible:Always
 
Summary:
In iOS 7.0.2, saving an image with UIImageJPEGRepresentation tints the image with a slightly purple color. Other versions of iOS such as iOS 6 do not have this bug.

Steps to Reproduce:
1. Install Xcode 5.0
2. Download and upload sample code.
3. Use the sample code to select an image from the camera roll using UIImagePickerController. (It is easiest to notice the bug by choosing a black and white image).
4. The sample code converts the selected UIImage to NSData using UIImageJPEGRepresentation.
5. It creates a UIImage from that NSData and displays it on screen.
6. By tapping on the image, you can easily switch between the original image, and the image after JPEG compression and restore, this way you can see how the images differ.

Expected Results:
The image after converting to JPEG data and then back should look almost identical to the original image. There should be no noticeable color differences. This is the behavior on iOS 6.

Actual Results:
You should see that the image from the JPEG compression is tinted purple and differs noticeably 

Version:
iOS 7.0.2

Notes:
Note, using a black and white image to test with, will most noticeably display the purple tint.
This bug is not reproducible in the simulator, only on the device. 

I've attached screenshots from the sample project using iOS 7.0.2 on my iPhone 5s.

I've also noticed this bug in the Twitter.app.

Configuration:
iOS 7
iPhone 5s
Xcode 5.0
OSX Mavericks

Original Image:
http://imgur.com/0IPRrKm

Image after JPEG Compression:
http://imgur.com/kRQgFpZ

Sample Project:
https://www.dropbox.com/s/d895jop3694a3ad/Purple%20Tint%20Bug%20Sample%20Project.zip

Comments

Duped as rdar://15290326


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!