Skip to content

Instantly share code, notes, and snippets.

@hellocatfood
Created May 5, 2013 08:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellocatfood/5520178 to your computer and use it in GitHub Desktop.
Save hellocatfood/5520178 to your computer and use it in GitHub Desktop.
Do batch conversions using GIMP via the command line. Replace file types on line 2 and 6
gimp -n -i -b - <<EOF
(let* ( (file's (cadr (file-glob "*.tiff" 1))) (filename "") (image 0) (layer 0) )
(while (pair? file's)
(set! image (car (gimp-file-load RUN-NONINTERACTIVE (car file's) (car file's))))
(set! layer (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
(set! filename (string-append (substring (car file's) 0 (- (string-length (car file's)) 4)) ".xcf"))
(gimp-file-save RUN-NONINTERACTIVE image layer filename filename)
(gimp-image-delete image)
(set! file's (cdr file's))
)
(gimp-quit 0)
)
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment