You should be automatically redirected . If not, visit
http://newlisper.wordpress.com
and update your bookmarks.

19/04/2006

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

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)

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home