title: Creating UIImage from CIImage
body: <p>I am using some CoreImage filters to process an image. Applying the filter to my input image results in an output image called filterOutputImage of type CIImage.</p>
  
  <p>I now wish to display that image, and tried doing:</p>
  
  <pre><code>self.modifiedPhoto = [UIImage imageWithCIImage:filterOutputImage];
  self.photoImageView.image = self.modifiedPhoto;
  </code></pre>
  
  <p>The view however is blank - nothing is being displayed.</p>
  
  <p>If I add logging statements that print out details about both filterOutputImage and self.modifiedPhoto, those logging statements are showing me that both those vars appear to contain legitimate image data: their size is being reported and the objects are not nil.</p>
  
  <p>So after doing some Googling, I found a solution that requires going through a CGImage stage; vis:</p>
  
  <pre><code>CGImageRef outputImageRef = [context createCGImage:filterOutputImage fromRect:[filterOutputImage extent]];
  self.modifiedPhoto = [UIImage imageWithCGImage:outputImageRef scale:self.originalPhoto.scale orientation:self.originalPhoto.imageOrientation];
  self.photoImageView.image = self.modifiedPhoto;
  CGImageRelease(outputImageRef);
  </code></pre>
  
  <p>This second approach works: I am getting the correct image displayed in the view.</p>
  
  <p>Can someone please explain to me why my first attempt failed? What am I doing wrong with the imageWithCIImage method that is resulting in an image that seems to exist but can't be displayed? Is it always necessary to "pass through" a CGImage stage in order to generate a UIImage from a CIImage?</p>
  
  <p>Hoping someone can clear up my confusion :)</p>
  
  <p>H.</p>