Skip to content

Instantly share code, notes, and snippets.

@azurecube
Created November 5, 2012 15:40
Show Gist options
  • Save azurecube/4017847 to your computer and use it in GitHub Desktop.
Save azurecube/4017847 to your computer and use it in GitHub Desktop.
Small Script-foo sample
(define (script-fu-resize-export img)
(let*
((filename (car (reverse (strbreakup (car (gimp-image-get-filename img)) "/"))))
(dirname (foldr (lambda (base elm) (string-append base elm "/")) "" (reverse (cdr (reverse (strbreakup (car (gimp-image-get-filename img)) "/"))))))
(drawable (car (gimp-image-get-active-layer img)))
(retouch (string-append dirname "retouch/" filename))
(resize (string-append dirname "retouch/" "resize/" filename)))
; (file-jpeg-save RUN-NONINTERACTIVE img drawable retouch retouch 1 0 1 0 "" 0 1 0 0)
(gimp-file-save RUN-NONINTERACTIVE img drawable retouch retouch)
(gimp-image-scale img (* 0.32 (car (gimp-image-width img))) (* 0.32 (car (gimp-image-height img))))
(file-jpeg-save RUN-NONINTERACTIVE img drawable resize resize 0.85 0 1 0 "" 0 1 0 0)))
(script-fu-register
"script-fu-resize-export" ;func name
"Image" ;menu label
"Save original size and resized data" ;description
"azurecube" ;author
"copyright 2012 azurecube" ;copyright notice
"October 28, 2012" ;date created
"" ;image type that the script works on
SF-IMAGE "Image" 0
)
(script-fu-menu-register "script-fu-resize-export" "<Image>/Image/resize-export")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment