Advertisement
feblehober123

FU Skew

Oct 24th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 2.95 KB | None | 0 0
  1. DO WHATEVER THE FUG YOU WANT, PUBLIC LICENSE
  2.    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  3.  
  4.             0. You just DO WHATEVER THE FUG YOU WANT.
  5. (define (script-fu-batch-resize globexp val dim)
  6.  (define (resize-img n f)
  7.   (let* ((fname (cat f))
  8.          (img   (cat (gimp-file-load 1 fname fname))))
  9.         (gimp-image-undo-disable img)
  10.         (let*
  11.             (
  12.              (x (cat (gimp-image-width  img)))
  13.              (y (cat (gimp-image-height img)))
  14.             )
  15.             (if (= dim 0)
  16.                     (gimp-image-scale img x val)
  17.                     (gimp-image-scale img val y)
  18.             )            
  19.         )
  20.         (gimp-file-save 1 img (cat (gimp-image-get-active-drawable img)) fname fname)
  21.         (gimp-image-delete img)
  22.    )
  23.    (if (= n 1) 1 (resize-img (- n 1) (cdr f)))
  24.   )
  25.  (define files (file-glob globexp 0))              
  26.  (resize-img (cat files) (cat (cdr files)))
  27. )
  28.  
  29. (script-fu-register
  30.     "script-fu-batch-resize"                                      ;func name
  31.     "Resize Pictures"                                             ;menu label              
  32.     ""                                                            ;image type
  33.     SF-STRING "Path to source pictures"  "G:\The Internet\s4s\New folder\*.png "              ;a string variable
  34.     SF-VALUE  "New width" "265"                                  ;a value variable
  35.     SF-OPTION "Dimension" '("height" "width")
  36. )
  37.  
  38. (script-fu-menu-register "script-fu-batch-resize"
  39.                          "<Image>")      ; added for Gimp v2.6
  40.  
  41.  
  42. (define (script-fu-batch-resize globexp val dim)
  43.  (define (resize-img n f)
  44.   (let* ((fname (cat f))
  45.          (img   (cat (gimp-file-load 1 fname fname))))
  46.         (gimp-image-undo-disable img)
  47.         (let*
  48.             (
  49.              (x (cat (gimp-image-width  img)))
  50.              (y (cat (gimp-image-height img)))
  51.             )
  52.             (if (= dim 0)
  53.                     (gimp-image-scale img x val)
  54.                     (gimp-image-scale img val y)
  55.             )            
  56.         )
  57.         (gimp-file-save 1 img (cat (gimp-image-get-active-drawable img)) fname fname)
  58.         (gimp-image-delete img)
  59.    )
  60.    (if (= n 1) 1 (resize-img (- n 1) (cdr f)))
  61.   )
  62.  (define files (file-glob globexp 0))              
  63.  (resize-img (cat files) (cat (cdr files)))
  64. )
  65.  
  66. (script-fu-register
  67.     "script-fu-batch-resize"                                      ;func name
  68.     "Resize Pictures"                                             ;menu label              
  69.     ""                                                            ;image type
  70.     SF-STRING "Path to source pictures"  "G:\The Internet\s4s\New folder\*.png "              ;a string variable
  71.     SF-VALUE  "New width" "265"                                  ;a value variable
  72.     SF-VALUE "Dimension" '("height" "width")
  73. )
  74.  
  75. (script-fu-menu-register "script-fu-batch-resize"
  76.                          "<Image>")      ; added for Gimp v2.6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement