0

I already took a look at GetIconRefFromFileInfo() and QLThumbnailImageCreate() but they just doesn't seem to be similar with what I see from the finder, which is a square icon with watermarks on it, e.g. if the file is RTF, it has this greyish watermark below that says RTF or RTFD or PDF...

Please help me out on this. Thanks. If the question is still unclear, please feel free to comment.

jopes
  • 245
  • 2
  • 13
  • By "watermark," you mean the text at the bottom of the icon indicating the file type? That's not really a watermark... – Matt Ball Aug 21 '09 at 15:44
  • Are you referring to the *document icons* as, for example, provided by the Preview application located in `/Applications/Preview.app/Contents/Resources/`, such as `gif.icns`? (These are not square icons, they have that curly upper-right corner to indicate they're documents. Also, the text "GIF" is then called a badge.) So: you want the document icons as shown at http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGIcons/XHIGIcons.html#//apple_ref/doc/uid/20000967-TPXREF124 ? And instead of the specific icon you get `Generic.icns`? – Arjan Aug 23 '09 at 10:42
  • Actually I wanna get the document icons with Preview in them, and yes with the folded part on the upper-right corner. I can't seem to get it using QLThumbnailImageCreate... – jopes Aug 23 '09 at 17:34
  • What you're asking is still unclear. "Preview" meaning the application Preview.app, or "preview" as in the icon on the .dng file in this picture: http://forums.rennlist.com/upload/finder_error.jpg ? – Matt Ball Aug 24 '09 at 16:18
  • By the way, jopes, how are you offering a bounty for more reputation than you currently have? – Matt Ball Aug 24 '09 at 16:20
  • Bounty has already ended... I dunno how to extend it :( I still haven't found my answer, sorry guys... – jopes Aug 25 '09 at 21:14
  • Also what I meant was "Show preview icons" option turned on inside Finder's "Show View Options" – jopes Aug 25 '09 at 23:52
  • (@Matt, bounty is subtracted from the questioner's reputation as soon as it is offered, not when it expires. See http://stackoverflow.com/users/59463?tab=reputationhistory) – Arjan Aug 31 '09 at 19:38
  • jopes: The icons with folded corners are what the GetIconRef* functions return, so that *is* what you're looking for. If you disagree, please post example images of what you're looking for and what you got back from `GetIconRefFromFileInfo`. You can use imgur to host them: http://imgur.com/ – Peter Hosey Jul 04 '10 at 15:11
  • And if you really are looking for Quick Look previews, then the same question applies: Please post an image of what you wanted (what Finder displays) and an image of what you got from `QLThumbnailImageCreate`. – Peter Hosey Jul 04 '10 at 15:22

1 Answers1

1

From MacScripter:

This is a category on NSImage which lets you get an image containing a Quick Look preview of the content of a given file. If no Quick Look preview is available, it will instead return the file's Finder icon (this is what the Quick Look panel does). It consists of only one method:

+ (NSImage *) imageWithPreviewOfFileAtPath: (NSString*) path ofSize: (NSSize) size asIcon: (BOOL) icon

mcandre
  • 22,868
  • 20
  • 88
  • 147
  • Hi. Thanks for the answer, but if you saw the code inside `NSImage+QuickLook.m`, it did use `QLThumbnailImageCreate()`, and if it's nil, it'll just use `NSWorkspace`'s provided icon for the file, effectively calling `GetIconRefFromFileInfo()`. I'm sorry but I think this is not the answer I'm looking for. – jopes Aug 17 '09 at 21:02