I am trying to draw one image onto another and then output that composite image as an image file. The method works fine the first time I call it but any subsequent calls layer another image upon the last composite. I.e. it keeps layering instead of getting a new background image.

I hope I have made myself clear (its a little hard to explain) any help would be much appreciated.

```
-(NSImage *)compositeImage:(NSImage *)overlay Onto:(NSImage *)background AtPoint:(NSPoint)location{
NSImage *returnImage;

[background lockFocus];

[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
[overlay drawInRect:NSMakeRect(location.x, location.y, [overlay size].width, [overlay size].width) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];

[background unlockFocus];

returnImage = background;

return returnImage;

```

}