Plus dispo apparemment : le lien ne marche plus et je ne le retrouve pas sur le site
| A ne pas rater!!! |
|---|
Retrouvez ici toutes les formations photo Pixelistes N'oubliez pas de commander votre calendrier photo Pixelistes 2012, c'est ici. |
Modérateurs: Modérateurs, Rédacteurs
; Copyright (C) 2009 Claude auribault
; 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.
; You should have received a copy of the GNU General Public License along with this program;
; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; ca-drop-shadow.scm version 1.00 2009/06/12
; CHANGE-LOG:
; 1.00 - initial release
;
; Copyright (C) 2009 Claude Auribault <claude.auribault@gmail.com>
; Adds a drop-shadow on RGB and grayscale images.
; Creates a copy of the image or can optionally work on the original.
; The result is flattened.
; If working on a copy, "_ds" is added to the original filename
; Uses the current background color to create border background.
; Can operate on currently loaded image
; Menu: "<Image>/CA/Encadrements/DropShadow"
; or in batch mode on a directory
; Menu: "<Image>/CA/Batchs/DropShadow"
;
;=======================================================================================================
(define (add-shadow image drawable marge-x marge-y ombre blur-radius gauss)
(let*
( (type (car (gimp-drawable-type-with-alpha drawable)))
(image-width (car (gimp-image-width image)))
(image-height (car (gimp-image-height image)))
(shadow-layer 0)
)
(gimp-context-push)
(gimp-image-set-active-layer image drawable)
(gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable)
(gimp-selection-layer-alpha drawable)
(let*
( (ombre-x ombre)
(ombre-y ombre)
(shadow-width (+ image-width (* 2 ombre-x)))
(shadow-height (+ image-height (* 2 ombre-y)))
)
(gimp-image-resize image (+ image-width (* 2 marge-x)) (+ image-height(* 2 marge-y)) marge-x marge-y)
(set! shadow-layer (car (gimp-layer-new image shadow-width shadow-height type "DropShadow" 80 NORMAL-MODE)))
(gimp-image-add-layer image shadow-layer -1)
(gimp-layer-set-offsets shadow-layer ombre-x ombre-y)
(gimp-drawable-fill shadow-layer TRANSPARENT-FILL)
(gimp-context-set-background '(0 0 0))
(gimp-edit-fill shadow-layer BACKGROUND-FILL)
(gimp-selection-none image)
(gimp-layer-set-lock-alpha shadow-layer FALSE)
(if (= gauss 0)
(plug-in-gauss-rle RUN-NONINTERACTIVE image shadow-layer blur-radius TRUE TRUE)
(plug-in-gauss-iir RUN-NONINTERACTIVE image shadow-layer blur-radius TRUE TRUE)
)
(gimp-layer-translate shadow-layer ombre-x ombre-y)
)
(if (= (car (gimp-layer-is-floating-sel drawable)) 0)
(gimp-image-raise-layer image drawable)
)
(gimp-image-set-active-layer image drawable)
(gimp-image-undo-group-end image)
(gimp-displays-flush)
(gimp-context-pop)
)
) ;=== add-shadow ==================================================================================
(define (drop-shadow-int img marge-x marge-y ombre shade-radius gauss)
(let*
( (width (car (gimp-image-width img)))
(height (car (gimp-image-height img)))
(drawable (car (gimp-image-get-active-layer img)))
(type (car (gimp-drawable-type-with-alpha drawable)))
(pic-layer (car (gimp-image-get-active-drawable img)))
(bg-layer 0)
)
(gimp-layer-add-alpha pic-layer)
(add-shadow img pic-layer marge-x marge-y ombre shade-radius gauss)
(set! bg-layer (car (gimp-layer-new img width height type "Background" 100 NORMAL-MODE)))
(gimp-drawable-fill bg-layer BACKGROUND-FILL)
(gimp-image-add-layer img bg-layer -1)
(gimp-image-raise-layer img pic-layer)
(gimp-image-lower-layer img bg-layer)
(gimp-image-flatten img)
)
) ;=== drop-shadow-int =============================================================================
(define (ca-drop-shadow img drawable marge-x marge-y ombre shade-radius gauss work-on-copy?)
(let*
( (image (cond ((= work-on-copy? TRUE) (car (gimp-image-duplicate img))) ('else img)))
)
(if (= work-on-copy? TRUE)
(gimp-image-undo-disable image)
(gimp-image-undo-group-start image)
)
(drop-shadow-int image marge-x marge-y ombre shade-radius gauss)
(if (= work-on-copy? TRUE)
(begin
(gimp-image-undo-enable image)
(gimp-display-new image)
)
(gimp-image-undo-group-end image)
)
(gimp-displays-flush)
)
) ;=== ca-drop-shadow ==============================================================================
(script-fu-register "ca-drop-shadow"
"<Image>/CA/Encadrements/DropShadow"
"Add a drop-shadow and background"
"Claude Auribault <claude.auribault@gmail.com>"
"Claude Auribault"
"12/06/2009"
"RGB GRAY"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Marge horizontale" '(64 0 4096 1 10 0 1)
SF-ADJUSTMENT "Marge verticale" '(64 0 4096 1 10 0 1)
SF-ADJUSTMENT "Ombre" '(32 0 4096 1 10 0 1)
SF-ADJUSTMENT "Rayon du flou" '(32 0 1024 1 10 0 1)
SF-OPTION "Mode Gauss" '("Gauss RLE" "Gauss IIR")
SF-TOGGLE "Sur copie ?" TRUE
) ;===================================================================================================
(define (drop-shadow-file filename marge-x marge-y ombre shade-radius gauss work-on-copy?)
(let*
(
(fileparts 0)
(new-filename 0)
(file-image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(display (car (gimp-display-new file-image)))
(image 0)
)
(if (= work-on-copy? TRUE)
(begin
(set! fileparts (strbreakup filename "."))
(set! new-filename (string-append (car fileparts) "_ds." (cadr fileparts)))
(set! image (car (gimp-image-duplicate file-image)))
)
(begin
(set! image file-image)
)
)
(drop-shadow-int image marge-x marge-y ombre shade-radius gauss)
(if (= work-on-copy? TRUE)
(begin
(gimp-image-set-filename image new-filename)
(gimp-file-save 1 image (car (gimp-image-get-active-drawable image)) new-filename new-filename)
(gimp-image-clean-all image)
(gimp-image-clean-all file-image)
(gimp-display-delete display)
)
(begin
(gimp-file-save 1 image (car (gimp-image-get-active-drawable image)) filename filename)
)
)
(gimp-image-clean-all image)
(gimp-display-delete display)
)
) ;=== drop-shadow-file ============================================================================
(define (ca-drop-shadow-dir dir ft marge-x marge-y ombre shade-radius gauss work-on-copy?)
(let*
( (path (string-append dir "/" ft))
(filelist (cadr (file-glob path 1)))
(filename 0)
)
(if (= (length filelist) 0)
(gimp-message (string-append "Aucun fichier correspondant à " path))
(while (not (null? filelist))
(set! filename (car filelist))
(drop-shadow-file filename marge-x marge-y ombre shade-radius gauss work-on-copy?)
(set! filelist (cdr filelist))
)
)
)
) ;=== ca-drop-shadow-dir ==========================================================================
(script-fu-register "ca-drop-shadow-dir"
"<Image>/CA/Batchs/DropShadow"
"Add a drop-shadow and background"
"Claude Auribault <claude.auribault@gmail.com>"
"Claude Auribault"
"12/06/2009"
""
SF-DIRNAME "Répertoire" ""
SF-STRING "Type de fichier" "*.jpg"
SF-ADJUSTMENT "Marge horizontale" '(64 0 4096 1 10 0 1)
SF-ADJUSTMENT "Marge verticale" '(64 0 4096 1 10 0 1)
SF-ADJUSTMENT "Ombre" '(32 0 4096 1 10 0 1)
SF-ADJUSTMENT "Rayon du flou" '(32 0 1024 1 10 0 1)
SF-OPTION "Mode Gauss" '("Gauss RLE" "Gauss IIR")
SF-TOGGLE "Sur copie ?" TRUE
) ;===================================================================================================





Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités