Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

High-resolution icon for file in Mac OS X?

Tags:

macos

cocoa

icons

I am looking for a method exactly like -[NSWorkspace iconForFile:] but which returns the icon in a higher resolution if possible. In particular, I have an app which makes use of QuickLook to display previews of files, and I'd like it to fall back to the file icon if no quick look plugin is available. Using the iconForFile: method, however, yields a small 32x32 icon. Is there a better method around? One that returns an NSImage or CGImageRef is preferred, but less accessible methods might be fine too.

like image 496
Niko Matsakis Avatar asked Jan 30 '10 19:01

Niko Matsakis


1 Answers

The returned image of -[NSWorkspace iconForFile:] contains multiple representations, including higher resolution ones.

If you try drawing it at 512x512 it will automatically pick the appropriate representation.

like image 50
cobbal Avatar answered Sep 22 '22 05:09

cobbal