samj wrote:
Bonjour,
I'll use a script-fu because it allows you to select Gimp gradients and patterns. It also allows you to set the layer (opacity, mode, etc.).
As far to set layer opacity and mode gmic offers even more options (i.e. more modes) then Gimp.
it may be nice a script that first allow to set gradient, pattern and what else,and if needed convert them in images (new layers) that could be loaded by gmic, and then call gmic interactively so would be a preview become available to fine tune.
Edit to clear my suggestion
1 a script that allow to chose and if needed (may be no needed for jpg,and png pattern, and always needed for gradient and .pat) export them as new layer of the active image
then giving the initial active layer and the new "gradient" and "Pattern" layers as input argument call interactively a Gmic filter
2) a new gmic filter to be called
the new filters will not depend upon the script (only vice versa) and could work or called by the script
or called from gmic, in this case it expect to the user set correctly the gmic input options and a "gradient" and "pattern" layer to load
(as the inpainting filter expect a mask layer)
I have a script from RobA that if modified could be useful:
as it is export all gradients,
but maybe be mod to export a user chosen gradient and pattern as new layer
; export_gradients.scm
; by Rob Antonishen
; http://silent9.com
; Version 1.0 (20120126)
; Description
;
; export png images of every gradient the size of the active drawable
;
; License:
;
; 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 2 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.
;
; The GNU Public License is available at
; http://www.gnu.org/copyleft/gpl.html
(define (script-fu-export_gradients img inLayer inShape inDestDir inSaveType inFileName inFileNumber)
(let*
(
(width (car (gimp-image-width img)))
(height (car (gimp-image-height img)))
(imgTemp (car (gimp-image-duplicate img)))
(layerTemp (car (gimp-image-flatten imgTemp)))
(gradientlist (gimp-gradients-get-list ""))
(counter 0)
(saveExt (cond (( equal? inSaveType 0 ) ".png" ) (( equal? inSaveType 1 ) ".jpg" ) (( equal? inSaveType 2 ) ".bmp" )))
(newFileName "")
)
; it begins here
(gimp-image-undo-disable imgTemp)
(gimp-selection-none imgTemp)
(gimp-layer-add-alpha layerTemp)
(while (< counter (car gradientlist))
(gimp-edit-clear layerTemp)
(gimp-context-set-gradient (list-ref (cadr gradientlist) counter))
(gimp-edit-blend layerTemp CUSTOM-MODE NORMAL-MODE inShape 100 0 REPEAT-NONE FALSE TRUE 3 0.20 TRUE 0 0 width 0)
;save file
(set! newFileName (string-append inDestDir DIR-SEPARATOR inFileName (number->string (+ inFileNumber counter)) saveExt))
(gimp-file-save RUN-NONINTERACTIVE imgTemp layerTemp newFileName newFileName)
(set! counter (+ counter 1))
)
(gimp-image-delete imgTemp)
(gimp-displays-flush)
)
)
(script-fu-register "script-fu-export_gradients"
"<Image>/Filters/Export Gradients..."
"Export all gradients as images."
"Rob Antonishen"
"Rob Antonishen"
"Oct 2012"
"RGB*"
SF-IMAGE "image" 0
SF-DRAWABLE "drawable" 0
SF-OPTION "Shape" '("Linear")
SF-DIRNAME "Save to" ""
SF-OPTION "File Type" '("png" "jpg" "bmp")
SF-STRING "File Base Name" "GRADIENT"
SF-ADJUSTMENT "Start Number" '(0 0 9000 1 100 0 SF-SPINNER)
)