title: Is it possible to save an image with Core Graphics on the iPhone?
body: <p>The following code converts a PDF page into a JPEG. It runs as expected on Snow Leopard:</p>
  
  <pre><code>...
  //get the image from the bitmap context
  CGImageRef image = CGBitmapContextCreateImage(outContext);
  
  //create the output destination
  CGImageDestinationRef outfile = CGImageDestinationCreateWithURL(fileUrl, kUTTypeJPEG, 1, NULL);
  
  //add the image to the output file
  CGImageDestinationAddImage(outfile, image, NULL);
  CGImageDestinationFinalize(outfile);
  ...
  </code></pre>
  
  <p>This code fails when compiled for iPhone because the iPhone version of Core Graphics does not include <code>CGImageDestinationRef</code>. Is there any way to save <code>CFImageRef</code> to a jpeg using the native iPhone frameworks and libraries? The only alternative I can think of is to ditch Core Graphics and use ImageMagick.</p>