From 37dd5c5a384a5a5a88c757c9c37f76159597117b Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 28 Sep 2015 16:38:13 +0100 Subject: [PATCH] Added a scripts folder and placed the gimp-scripts in it. --- .../batch-drop-shadow.scm | 0 scripts/round-top-corners.scm | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+) rename batch-drop-shadow.scm => scripts/batch-drop-shadow.scm (100%) create mode 100644 scripts/round-top-corners.scm diff --git a/batch-drop-shadow.scm b/scripts/batch-drop-shadow.scm similarity index 100% rename from batch-drop-shadow.scm rename to scripts/batch-drop-shadow.scm diff --git a/scripts/round-top-corners.scm b/scripts/round-top-corners.scm new file mode 100644 index 0000000..f5658e8 --- /dev/null +++ b/scripts/round-top-corners.scm @@ -0,0 +1,32 @@ + ; Place the script in your gimp scripts folder (eg. ~/.gimp-2.8/scripts) go to the + ; folder with images you wish to round corners on and execute like this: + ; gimp --no-data -i -b '(round-top-corners "*.png")' -b '(gimp-quit 0)' + ; + + (define (round-top-corners pattern) + (let* ((filelist (cadr (file-glob pattern 1)))) + (while (not (null? filelist)) + (let* ((filename (car filelist)) + (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) + (width (car (gimp-image-width image))) + (drawable (car (gimp-image-get-active-layer image)))) + ; select 6 pixels in the top left corner and clear them + (gimp-rect-select image 0 0 2 2 REPLACE 0 0) + (gimp-rect-select image 0 2 1 1 ADD 0 0) + (gimp-rect-select image 2 0 1 1 ADD 0 0) + (define cornerselectionleft (car (gimp-image-active-drawable image))) + (gimp-edit-clear cornerselectionleft) + ; select 6 pixels in the top right corner and clear them + (gimp-rect-select image (- width 2) 0 2 2 REPLACE 0 0) + (gimp-rect-select image (- width 3) 0 1 1 ADD 0 0) + (gimp-rect-select image (- width 1) 2 1 1 ADD 0 0) + (define cornerselectionright (car (gimp-image-active-drawable image))) + (gimp-edit-clear cornerselectionright) + (set! drawable (car (gimp-image-merge-visible-layers image 0))) + (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) + (gimp-image-delete image) + ) + (set! filelist (cdr filelist)) + ) + ) + )