title: iPhone: Changing CGImageAlphaInfo of CGImage
body: <p>I have a PNG image that has an unsupported bitmap graphics context pixel format. Whenever I attempt to resize the image, <code>CGBitmapContextCreate()</code> chokes on the unsupported format  </p>
  
  <p>I receive the following error (error formatted for easy reading):</p>
  
  <pre><code>CGBitmapContextCreate: unsupported parameter combination: 
      8 integer bits/component; 
      32 bits/pixel; 
      3-component colorspace; 
      kCGImageAlphaLast; 
      1344 bytes/row.
  </code></pre>
  
  <p>The <a href="http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html#//apple_ref/c/tdef/CGImageAlphaInfo" rel="noreferrer">list of supported pixel formats</a> definitely does not support this combination. It appears I need to redraw the image and move the alpha channel information to <a href="http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGImage/Reference/reference.html#//apple_ref/doc/uid/TP30000956-CH3g-C016217" rel="noreferrer">kCGImageAlphaPremultipliedFirst or kCGImageAlphaPremultipliedLast</a>.</p>
  
  <p>I have no idea how to go about doing this. </p>
  
  <p>There is nothing unusual about the PNG file and it isn't corrupted. It works in all other context just fine. I encountered this error just by chance but obviously my users might have similarly formatted files so I will have to check my app's imported images and correct for this problem. </p>