NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSFont fontWithName:@"Helvetica" size:12], NSFontAttributeName, [NSColor blackColor], NSForegroundColorAttributeName, nil]; NSAttributedString *myString = [[NSAttributedString alloc] initWithString:@"hello" attributes: attributes]; float stringHeight = [myString size].height; float stringWidth = [myString size].width; NSString *simpleString=@"hello"; NSImage* anImage = [[NSImage alloc] initWithSize:NSMakeSize(stringHeight, stringWidth)]; //[imageName drawString]; [anImage lockFocus]; //[simpleString drawInRect:NSMakeRect(0,0, [anImage size].height, [anImage size].width) withAttributes:attributes]; [myString drawAtPoint:NSZeroPoint]; [anImage unlockFocus];