Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSWorkspace iconForFile: returns image of low quality

I'm using iconForFile: selector of NSWorkspace class, but it returns an image of low quality.

Can anyone tell me why is this happening? Is there any switch or flag to tell the framework to return an image in a different format?

like image 379
user2381688 Avatar asked May 14 '13 13:05

user2381688


1 Answers

The docs state the returned icon's size is 32x32, but you can use -[NSImage setSize:] and it may load a larger representation:

NSImage * iconImage = [[NSWorkspace sharedWorkspace] iconForFile:file];
[iconImage setSize:NSMakeSize(128, 128)];

You can also use Icon Services (e.g. GetIconRefFromFileInfo) or QuickLook (e.g. QLThumbnailImageCreate) for a file's icon or preview icon at a larger size.

like image 58
justin Avatar answered Oct 11 '22 07:10

justin