title: Add a white background to an NSImage that is larger than the original image
body: <p>I am currently adding a solid white background to an NSImage so that in the case that the image has a transparent background it becomes opaque.</p>
  
  <p>What I would like to be able to do is increase the size of the white background so that it extends out all around the original image (thus giving it a white border).</p>
  
  <p>This is what I currently have, but I can't work out how to create the white image larger that the original.</p>
  
  <pre><code>NSImage* importedImage = [bitmapImage image];
  
  NSSize imageSize = [importedImage size];
  NSImage* background = [[NSImage alloc] initWithSize:imageSize];
  
  [background lockFocus];
  [[NSColor whiteColor] setFill];
  
  [NSBezierPath fillRect:NSMakeRect(0, 0, imageSize.width, imageSize.height)];
  [background unlockFocus];
  
  theImage = [[NSImage alloc] initWithSize:imageSize];
  [theImage lockFocus];
  CGRect newImageRect = CGRectZero;
  newImageRect.size = [theImage size];
  [background drawInRect:newImageRect];
  [importedImage drawInRect:newImageRect];
  [theImage unlockFocus];
  </code></pre>