I program command-line application that will load image from Supporting Files. Image is copied in Supporting Files, but when I use following code, variable imgC returns nil.
NSString* pathC = @"galaxy.jpg";
NSImage* imgC = [NSImage imageNamed: pathC];
ImgC returns nil even if I use the following code:
NSString* pathC = @"galaxy.jpg";
NSImage* imgC = [[NSImage alloc] initWithContentsOfFile: pathC];
Can someone please help me?
(PS: Sorry for my bad English.)
Many thanks, Peter
Swift Style:
if let imageRef = NSImage(byReferencingFile: "/path/to/galaxy.jpg")
{
println("image size \(imageRef.size.width):\(imageRef.size.height)")
}