This weekend I got the latest version of Gimp running on my Mac, and started playing with some of the artistic filters.
I came across a combination that results in a look somewhat reminiscent of look of the movie A Scanner Darkly, and decided to write a Gimp script to apply this combination. Then I got curious about applying this to video, and ended up figuring out how to do that. The results are pretty cool looking.
- Split your video into frames at 30fps. I used iMovie ‘08 to do this.
- Run the batch-scanner-gimply command in Gimp to batch-process all the frames. This can be done from the command-line, eg:
/Applications/Gimp.app/Contents/Resources/bin/gimp -i -b
'(batch-scanner-gimply "/Users/chris/Movies/Snorkeling/"
"Snorkeling*.jpg" 17 50 75)' -b '(gimp-quit 0)' - Use QuickTime 7 Pro to compose the processed frames back into a .mov file
- Bring it back into iMovie if you want to add the audio track back in. (Note that iMovie ‘08 has hidden the “extract audio” feature, but it’s still there.)
Here’s the scanner-gimply.scm file that needs to go in your Gimp scripts folder:
(define (batch-scanner-gimply folder
filepattern
oilsize
edgeamount
edgeopacity)
(let* ((filelist (cadr (file-glob (string-append folder filepattern) 1)))
(dirlength (string-length folder)))
(print "Start batch-scanner-gimply")
(while (not (null? filelist))
(let* ((filepath (car filelist))
(filename (substring filepath dirlength (string-length filepath)))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filepath filename)))
(baselayer (car (gimp-image-get-active-layer image)))
(oillayer (car (gimp-layer-copy baselayer FALSE))))
(print (string-append "Processing " folder filename))
(gimp-image-add-layer image oillayer -1)
(plug-in-oilify RUN-NONINTERACTIVE image oillayer oilsize 1)
(plug-in-edge RUN-NONINTERACTIVE image oillayer edgeamount 1 4)
(gimp-layer-set-mode oillayer 21)
(gimp-layer-set-opacity oillayer edgeopacity)
(gimp-image-flatten image)
(gimp-file-save RUN-NONINTERACTIVE
image (car (gimp-image-get-active-layer image))
filepath filename)
(print (string-append "Saved " filename))
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
Blogged with the Flock Browser











4 responses so far ↓
Hugh // January 5, 2009 at 10:48 pm |
Thats really cool Chris!
Nice Work
Ajzimm3rman // January 21, 2009 at 4:43 pm |
Wish I could do this in Linux.
Chris Campbell // January 21, 2009 at 4:48 pm |
@Ajzimm3rman: Well Gimp runs on Linux, and the script above should work fine. So then all you need to find is something that you can use to split video into frames, and then compose the frames back into video. There’s probably something available to do that…
daniel caleb // February 24, 2009 at 4:07 am |
I Used Virtual Dub with WINE on Ubuntu, gimped it and then fed the pics back into virtual dub. maybe a bit like cheating, but it works.