Mon Dec 02, 2019 11:22 pm
(define (batch-mirror-dup pattern iterations horizontal vertical workcopy)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-mirror-dup RUN-NONINTERACTIVE
image drawable iterations horizontal vertical workcopy)
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
gimp-2.10 -i -b '(batch-mirror-dup "*.png" 1 TRUE FALSE FALSE)' -b '(gimp-quit 0)'
Mon Dec 02, 2019 11:52 pm
Exception code=0xc0000005 flags=0x0 at 0x000000000067DD33. Access violation - attempting to read data at address 0x0000000000000000
Exception code=0xc0000005 flags=0x0 at 0x0000000000401D4D. Access violation - attempting to read data at address 0x0000000000000020
Tue Dec 03, 2019 2:01 am
Tue Dec 03, 2019 4:25 am
"D:\Program Files\GIMP 2.8\bin\gimp-console-2.10" -i -b "(batch-mirror-dup \"*.png\" 1.0 TRUE FALSE FALSE)" -b "(gimp-quit 0)"
Thu Dec 05, 2019 12:39 am
Thu Dec 05, 2019 3:34 am
Thu Dec 05, 2019 8:40 am
Thu Dec 05, 2019 10:10 pm
Fri Dec 06, 2019 7:15 am
;
; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; Mirror layer script for GIMP 2.4
; Created by Saul Goode
;
; Tags: layer, mirror
;
; Author statement:
;
;
; --------------------------------------------------------------------
; Distributed by Gimp FX Foundry project
; --------------------------------------------------------------------
; - Changelog -
;
; --------------------------------------------------------------------
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (script-fu_kjp24_mirror-dup work-image layer iterations horizontal vertical)
(let*
(
(new-layer 0)
(orig-width 0)
(orig-height 0)
)
(gimp-image-undo-group-start work-image)
(gimp-selection-none work-image)
(while (> iterations 0)
(set! layer (car (gimp-image-get-active-layer work-image)))
(if (> (car (gimp-image-get-layers work-image)) 1)
(set! layer (car (gimp-image-merge-visible-layers work-image EXPAND-AS-NECESSARY)))
)
(if (= horizontal TRUE)
(begin
(set! new-layer (car (gimp-layer-copy layer 1)))
(gimp-image-add-layer work-image new-layer -1)
(set! orig-width (car (gimp-drawable-width new-layer)))
(set! orig-height (car (gimp-drawable-height new-layer)))
(gimp-layer-resize new-layer (* 2 orig-width) orig-height 0 0)
(set! new-layer (car (gimp-drawable-transform-flip-simple new-layer ORIENTATION-HORIZONTAL TRUE orig-width 0)))
(gimp-image-resize-to-layers work-image)
(if (> (car (gimp-image-get-layers work-image)) 1)
(set! layer (car (gimp-image-merge-visible-layers work-image EXPAND-AS-NECESSARY)))
)
)
)
(if (= vertical TRUE)
(begin
(set! new-layer (car (gimp-layer-copy layer 1)))
(gimp-image-add-layer work-image new-layer -1)
(set! orig-width (car (gimp-drawable-width new-layer)))
(set! orig-height (car (gimp-drawable-height new-layer)))
(gimp-layer-resize new-layer orig-width (* 2 orig-height) 0 0)
(set! new-layer (car (gimp-drawable-transform-flip-simple new-layer ORIENTATION-VERTICAL TRUE orig-height 0)))
(gimp-image-resize-to-layers work-image)
)
)
(set! iterations (- iterations 1))
)
(gimp-selection-none work-image)
(if (> (car (gimp-image-get-layers work-image)) 1)
(set! layer (car (gimp-image-merge-visible-layers work-image EXPAND-AS-NECESSARY)))
)
(gimp-displays-flush)
(gimp-image-undo-group-end work-image)
)
)
(define (batch-mirror-dup pattern iterations horizontal vertical)
(let*
(
(filelist (cadr (file-glob pattern 1)))
)
(while (not (null? filelist))
(let*
(
(filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(layer (car (gimp-image-get-active-layer image)))
)
(gimp-message (string-append "Processing... " filename))
(script-fu_kjp24_mirror-dup image layer iterations horizontal vertical)
(set! layer (car (gimp-image-get-active-layer image)))
(gimp-file-save RUN-NONINTERACTIVE image layer filename filename)
(gimp-image-delete image)
)
(set! filelist (cdr filelist))
)
)
)
(script-fu-register "script-fu_kjp24_mirror-dup"
"Mirror Dup..."
"Mirror Duplication"
"Me"
"Me"
"2019.12.06"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Iterations" '(1 1 32 1 10 0 1)
SF-TOGGLE "Horizontal" TRUE
SF-TOGGLE "Vertical" FALSE
)
(script-fu-menu-register "script-fu_kjp24_mirror-dup" "<Image>/Script-Fu")
Fri Dec 06, 2019 7:58 pm