It looks like you should be using initWithContentsOfFile: in this situation rather than initByReferencingFile:. From the docs for NSImage:
- (id)initByReferencingFile:(NSString *)filename
Initializes the receiver, a newly allocated NSImage instance, for the file filename. This method initializes lazily: The NSImage doesn't actually open filename or create image representations from its data until an application attempts to composite or requests information about the NSImage.
The filename argument may be a full or relative pathname and should include an extension that identifies the data type in the file. The mechanism that actually creates the image representation for filename will look for an NSImageRep subclass that handles that data type from among those registered with NSImage.
After finishing the initialization, this method returns self. However, if the new instance can't be initialized, it's freed, and nil is returned. Since this method doesn't actually create image representations for the data, your application should do error checking before attempting to use the image; one way to do so is by invoking the isValid method to check whether the image can be drawn.
If the image can be cached because the cached size is smaller than the actual expanded size, that is, an image that is more than 72 dpi, then the original data is flushed and the cached image is used. If you resize the image either larger or smaller by less than 50%, the data is loaded in again from the file. If you expect the file to change or be deleted, you should use initWithContentsOfFile: instead.
This method invokes setDataRetained: with an argument of YES, thus enabling it to hold onto its filename. Note that if an image created with this method is archived, only the filename will be saved.