(archive 'newLISPer)

April 19, 2006

Thumbnail maker: another Big Cat script (Mac OS X)

Filed under: newLISP — newlisper @ 14:37
Tags:

>

I haven’t had time for much Lisp recently, but I did need to whip up this useful script which makes 150 pixel thumbnail images from selected files. I run it using Big Cat: save this script as a text file in the ~/Library/Application Support/Big Cat Scripts/Files folder, set the execute permissions, and then choose it from the Finder menu with some files selected. It doesn’t do anything much except call the system image procesing command sips, but it took me 15 minutes to find the right option, so hopefully it might save someone else a bit of searching.

#!/usr/bin/newlisp
(define (thumbnail-file file-name max-dimension)
    (and
        (find ".jpg|.png" file-name 1)
        (set 'new-file-name (replace "."
            (string file-name) (string "-" max-dimension ".")))
        (set 'sips-command
            (format "sips --resampleHeightWidthMax %d '%s' --out '%s'"
                        max-dimension file-name new-file-name))
        (exec sips-command)))
(set 'file-list (rest (rest (main-args))))
(dolist (f file-list)
    (thumbnail-file f 150))
(exit)
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: