title: Converting UIImage to NSData with UIImageJPEGRepresentaion() and saving it to a file increases the file size in bytes
body: <p>I have a requirement in which the user can select an image from <code>camera roll</code> and my application needs to optimize the image and upload it to a server. I am using <code>ALAssets</code> library and a custom picker for the user to select a photo from <code>camera roll</code>. I am able to achieve this perfectly but have a problem with the file size getting increased.  </p>
  
  <p>The problem is as follows:<br>
  When the user selects a photo, of 1.7MB (That is the full size as reported by the <code>iOS</code> when I try to mail the photo), when I directly get the bytes from the <code>ALAssetRepresentation</code> of that <code>ALAsset</code> and convert it to <code>NSData</code> the size of data is 1.7MB too. But, when I get a UIImage from the <code>ALAssetRepresentation</code> using the following code..  </p>
  
  <p>UIImage *selImage = [UIImage imageWithCGImage:[assetRepresentation fullResolutionImage] scale:[assetRepresentation scale] orientation:[assetRepresentation orientation]];</p>
  
  <p>and converting the <code>UIImage</code> to <code>NSData</code> using <code>UIImageJPEGRepresentation()</code> with compression quality = 1.0f, the NSData size becomes almost double the original size (3.2MB).</p>
  
  <p>Shouldn't it ideally be 1.7MB only??</p>
  
  <p>As expected, when I save it to a file, the file size still says 3.2MB (I checked it using xcode 4.2 by importing the sandbox app's documents folder). But the interesting thing is when I open the file with <code>Preview</code> on my mac, and check for the byte size, it says 1.7MB (was 3.2 MB) which is pretty confusing.. </p>
  
  <p>Please help..</p>
  
  <p>Thanks in advance.</p>