Last active
February 8, 2021 11:43
-
-
Save danstuken/3625841 to your computer and use it in GitHub Desktop.
Batch Convert XCF to JPEG in GIMP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (script-fu-xcf2jpg-batch xcfDirectory inQuality) | |
(let* ((xcfList (cadr (file-glob (string-append xcfDirectory "/*.xcf") 1)))) | |
(while (not (null? xcfList) ) | |
(let* ((xcfFilename (car xcfList)) | |
(jpgFilename (string-append (substring xcfFilename 0 (- (string-length xcfFilename) 4) ) ".jpg")) | |
(xcfImage (car (gimp-file-load RUN-NONINTERACTIVE xcfFilename xcfFilename))) | |
(xcfDrawable (car (gimp-image-flatten xcfImage))) ) | |
(file-jpeg-save RUN-NONINTERACTIVE xcfImage xcfDrawable jpgFilename jpgFilename | |
inQuality 0.0 0 0 "" 0 1 0 2) | |
) | |
(set! xcfList (cdr xcfList)) | |
) | |
) | |
) | |
(script-fu-register | |
"script-fu-xcf2jpg-batch" | |
"Batch XCF 2 JPEG" | |
"Converts all xcf files from a directory to JPEGS" | |
"Dan Kendall & Jérôme Combaz" | |
"" | |
"Apr 20 2013" | |
"" | |
SF-DIRNAME "Gimp Image Directory" "/tmp" | |
SF-ADJUSTMENT "Quality" '(0.85 0.00 1.00 0.01 0.1 2 0) | |
) | |
(script-fu-menu-register "script-fu-xcf2jpg-batch" | |
"<Toolbox>/Mine/Batch/2JPEG") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to add a slider for the JPEG quality. Added Jérôme's name following some great contributions