Where does mac store thumbnails of photos and videos?
November 23, 2008 9:33 AM   Subscribe

Where does mac store thumbnails of photos and videos? e.g. Finder thumbnails an SD disk I have plugged in that I pulled out of my digital camera. (where are those thumbnails?) e.g. A folder of movies are thumbnailed.
posted by guptaxpn to Computers & Internet (10 answers total)
 
It generates them on the fly. You can turn it off in the Finder's view settings.
posted by bonaldi at 9:57 AM on November 23, 2008


so there are no cache's at all?

it's re-generating thumbnails EVERY time I stick in an SD drive, or open up an iphoto folder?

Man, my mac is much faster than I had previously thought..
posted by guptaxpn at 10:22 AM on November 23, 2008


QuickLook is what handles the thumbnail generation (on 10.5) and while there's certainly a cache, it might only be in memory. Is there something in particular that you're trying to achieve?
posted by sbutler at 10:54 AM on November 23, 2008


It generates them on the fly. You can turn it off in the Finder's view settings.

That's mostly true. The Finder does generate previews on the fly, but programs can also store a thumbnail in the file's resource fork or, for packaged files, in the package.
posted by nathan_teske at 11:00 AM on November 23, 2008


@nathan_teske : where is the file's resource fork?
posted by guptaxpn at 11:03 AM on November 23, 2008


The HFS filesystem, for reasons of compatibility with ancient Apple operating systems, stores files in two "forks": a data fork, which is what you normally think of as a file, and a resource fork, which is an indexed set of typed data objects. For those of us accustomed to the concept of single-forked files, the resource fork is sort of mysterious. It's part of the file, but not part of the byte stream you would receive if you read the file. In the olden days the resource fork of an application would store things like strings, user interface elements, icons and bitmaps, and other blocks of largely immutable data. These days it's hardly used at all except by the Finder.

You could reasonably conceive of a file's resource fork as being filesystem metadata, but from a practical perspective that's not actually the case. HFS has metadata support, but it's distinct from the concept of forked files. Other filesystems (like NTFS) have support for multiple streams of data addressed by the same filename, but such capabilities are almost entirely unused.

In any case, the technical answer to "where is the file's resource fork?" is "in the file's resource fork." Where is it stored? In the file's resource fork.
posted by majick at 11:32 AM on November 23, 2008


While what majick says is absolutely true about HFS and HFS+, most SD cards are going to be formatted as FAT-16 or FAT-32, which has no support for resource forks. These are put in dot-files (files with the same name, but with a . in front of them), which the Finder ignores. You can see these from the Terminal. It seems like Windows ignores most of them too, but probably because they are (usually) flagged as hidden.

Mac OS X does this for all filesystems which don't support resource forks.

I don't know as if Mac OS X actually stores the generated thumbnails in the resource fork though. I just thought it was an interesting aside.
posted by tomierna at 12:48 PM on November 23, 2008


so is it stored in either a . file or a resource fork?

is it file-system dependent?

or is it it always one or the other?

also, are these cache's flushable? or search able via a script?
posted by guptaxpn at 3:36 PM on November 23, 2008


We're going to get on much better if you tell us what you're trying to do. You can ask anonymously if this is all yr porn thumbnails.

so is it stored in either a . file or a resource fork?
Depends on the filesystem. But they're only stored here if particular applications choose to, and that's increasingly rare under OS X. It's pretty unlikely that icons you're seeing are coming from the resource fork. Try turning off the previews in Finder preferences. If they disappear, they are being generated by the Finder.

also, are these cache's flushable? or search able via a script
No, no.
posted by bonaldi at 4:23 PM on November 23, 2008


In C what you're asking is very easy. QuickLook has a simple function you call to get the same thumbnail as the Finder displays, and using the Metadata framework (aka, Spotlight) you can query just about any info on the files you want.

From the command line, qlmanage lets you popup a window with the thumbnail, but there doesn't appear to be a way to write it out to a file. But writing a C program to do it is trivial. The Metadata Framework is accessible via mdfind and mdutil.

Even if you could access the QuickLook thumbnails directly, it's an extremely bad idea. Where ever they're stored, the directory and format is not documented, and might not even be accessible. For example, the Spotlight/Metadata information is only available to the root user. As a normal user you can't get access to the directories (which is why they built two handy utilities for you to call).

So again... what is it you're trying to do?
posted by sbutler at 2:01 AM on November 24, 2008


« Older how do pirates hijack a supertanker?   |   Doth my eyes deceive me? Or was is it Spielberg? Newer »
This thread is closed to new comments.