title: iOS: How to retrieve image dimensions X, Y from CGContextRef
body: <p>As it says on the can;  here is an example of why I need it:</p>
  
  <p>Let's say I create a bitmap context:</p>
  
  <pre><code>size_t pixelCount = dest_W * dest_H;
  
  typedef struct {
      uint8_t r,g,b,a;
  } RGBA;
  
  // backing bitmap store
  RGBA* pixels = calloc( pixelCount, sizeof( RGBA ) );
  
  // create context using above store
  CGContextRef X_RGBA;
  {
      size_t bitsPerComponent = 8;
      size_t bytesPerRow = dest_W * sizeof( RGBA );
  
      CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
  
      // create a context with RGBA pixels
      X_RGBA = CGBitmapContextCreate( (void *)pixels, dest_W, dest_H, 
                                     bitsPerComponent, bytesPerRow, 
                                     colorSpace, kCGImageAlphaNoneSkipLast
                                     );        
      assert(X_RGBA);
  
      CGColorSpaceRelease(colorSpace);
  }
  </code></pre>
  
  <p>Now I want to throw this context to a drawing function that will eg draw a circle touching the edges:</p>
  
  <p>Do I really need to throw in the width and height as well?   I am 99% sure I have seen some way to extract the width and height from the context, but I can't find it anywhere.</p>