As a Mac owner, I’ve really enjoyed how aesthetically pleasing everything is, including the icons. Even the tiniest icons look beautiful and clear. It only makes sense to make thumbnail icons out of your pictures so that you can view them in Finder. Freeware options exist to do this for you, but usually they require you to drag and drop or do it one folder at a time. You can just do everything. Now you can.
Turns out that one of the tweaks that Apple did to Darwin is called sips. It does lots of cool things with images but in particular it can add an icon thumbnail with the -i argument. And you can do this for multiple files, too. In fact, with a few more *nix commands, you can make a powerful statement that can search through your directories. For example, if you want to fix every image in your home (~) directory, you could do this in Terminal:
find ~ -iname "*.jp*g" -or -iname "*.gif" -or -iname "*.ti*f" -or -iname "*.png" | xargs -0 sips -i
This says to look through the whole directory structure that roots at your home directory and look for files that end with some typical image format extension (in a case insensitive manner) and then pass these files over as arguments (ignoring whitespace) to sips -i.
Actually for me the discovery of xargs was the real exciting bit. Many times I have wondered how to get past the fact that the pipe (|) doesn’t always work and this is why: they need to be passed as arguments. Duh. I mean this works fine:
ls | grep ".*jpg"
Which says list the contents of the current directory and then have grep search for any instances of lines ending with jpg. But if you add -l to ls then you get a directory listing, not a file listing. Try to pass this over to sips and it gets pissed. You can however, do the same thing as the above with ls | grep. In fact the command that will do the exact same thing is this:
ls -R | grep ".*[jJ][pP].*[gG]\|.*[gG][iI][fF]\|.*[tT][iI][fF]*\|.*[pP][nN][gG]" | xargs -0 sips -i
Which means list all the files starting with the current directory and work recursively through them and then pass it over to grep to look for one of these typical image file extensions in a case insensitive manner (note that the regular expressions that grep uses is a little more complicated than the simple asterisk in find) and then pass any lines that match over to sips -i as an arguement, ignoring any white space.
If you wanted to go all out, you could even contain that in an Automator application and run it every now and then! See, with a Mac, you can have the awesome power of *nix, but still have the easily-supported simple-to-use GUI environment that an Apple inheriently is. Jeez, maybe I should start working for them.