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.
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).
This is what I currently have, but I can't work out how to create the white image larger that the original.
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];