title: Using ALAssetsLibrary and ALAsset take out Image as NSData
body: <p>I wish to extract the image using ALAssetsLibrary and ALAsset directly in the form of a NSData object.</p>
  
  <p>Using a NSURL I take out the image in the following manner.</p>
  
  <pre><code>NSURL *referenceURL =newURL;
  ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
  [library assetForURL:referenceURL resultBlock:^(ALAsset *asset)
  {
       UIImage  *copyOfOriginalImage = [UIImage imageWithCGImage:[[asset defaultRepresentation] fullResolutionImage]];
  }
  </code></pre>
  
  <p>Now here we take the image as a UIImage, but I need to take the image directly as NSData.</p>
  
  <p>I wish to do this because (I have read that) once you take the image in UIImage, then we lose all the EXIF details of the Image.</p>
  
  <p>That's the reason I want to extract the image directly as NSData, instead of doing this  </p>
  
  <pre><code>NSData *webUploadData=UIImageJPEGRepresentation(copyOfOriginalImage, 0.5);
  </code></pre>
  
  <p>This step makes me lose all the EXIF details.</p>
  
  <p>Please Help.</p>