(define (script-fu-my_web_workflow image drawable theMaxWidth theMaxHeight FiletInterieur FiletExterieur CouleurInterieure CouleurExterieure Nettete Affichage) ; ; La largeur max est réduite de 2 fois la taille des filets interieur et exterieur ; (set! theWidth (- theMaxWidth (* 2 (+ FiletInterieur FiletExterieur)))) (set! theHeight (- theMaxHeight (* 2 (+ FiletInterieur FiletExterieur)))) ; ; On détermine comment il faut tailler la photo pour ne pas dépasser les maxima ; (set! theWebRatio (/ theHeight theWidth)) (set! theImageWidth (car (gimp-image-width image))) (set! theImageHeight (car (gimp-image-height image))) (set! theTempRatio (/ theImageHeight theImageWidth)) (if (<= theTempRatio theWebRatio) (begin (set! theFactor (/ theWidth theImageWidth)) ) (begin (set! theFactor (/ theHeight theImageHeight)) ) ) (set! theNewImageWidth (* theFactor theImageWidth)) (set! theNewImageHeight (* theFactor theImageHeight)) ; ; On travaille sur une copie de la photo ; (set! theImageCopy (car (gimp-image-duplicate image))) (set! theImageCopyDrawable (car (gimp-image-get-active-drawable theImageCopy))) ; ; La photo est mise à la valeur maximale pour SP ; (gimp-drawable-transform-scale theImageCopyDrawable 0 0 theNewImageWidth theNewImageHeight 0 2 FALSE 6 FALSE) ; ; On décompose l'image en mode LAB afin de faire le refocus uniquement sur la couche L ; (set! theImage (plug-in-decompose 1 theImageCopy theImageCopyDrawable "LAB" 0)) (set! theImageNumberL (car theImage)) (set! theImageNumberA (+ theImageNumberL 1)) (set! theImageNumberB (+ theImageNumberL 2)) (if (= Nettete 0) (begin ; ; Les couches sont utiles uniquement pour refocus ; (set! theLayers (gimp-image-get-layers theImageNumberL)) (set! theLayersArray (cadr theLayers)) (set! theLayerL (aref theLayersArray 0)) ; ; L'accentuation de netteté est lancée ; (plug-in-refocus 1 theImageNumberL theLayerL 25.0 0.9 0.0 0.5 0.01)) (begin (set! theImageNumberLDrawable (car (gimp-image-get-active-drawable theImageNumberL))) (plug-in-unsharp-mask 1 theImageNumberL theImageNumberLDrawable 5.0 0.3 1)) ) ; ; L'image est reconstituée ; (set! theNewImage (car (plug-in-compose 1 theImageNumberL drawable theImageNumberA theImageNumberB -1 "LAB"))) ; ; Libération des images temporaires ; (gimp-image-delete theImageCopy) (gimp-image-delete theImageNumberL) (gimp-image-delete theImageNumberA) (gimp-image-delete theImageNumberB) (set! theNewImageDrawable (car (gimp-image-get-active-drawable theNewImage))) ; ; Deux bordures sont ajoutées ; (if (>= FiletInterieur 1) (script-fu-addborder theNewImage theNewImageDrawable FiletInterieur FiletInterieur CouleurInterieure 1)) (if (>= FiletExterieur 1) (script-fu-addborder theNewImage theNewImageDrawable FiletExterieur FiletExterieur CouleurExterieure 1)) ; ; L'image est aplatie puis enfin affichée ; (set! theNewImageLayer (car (gimp-image-flatten theNewImage))) (if (= Affichage 0) (gimp-display-new theNewImage) ) ) (script-fu-register "script-fu-my_web_workflow" "/Script-Fu/Utils/My Web Workflow..." "Workflow de traitement pour publication sur internet" "Stephan Peccini (stephan@photonature.fr)" "Stephan Peccini" "April 2005" "RGB* GRAY*" SF-IMAGE "Input Image" 0 SF-DRAWABLE "Input Drawable" 0 SF-ADJUSTMENT "Largeur Maximum" '(600 100 1000 100 100 0 1) SF-ADJUSTMENT "Hauteur Maximum" '(600 100 1000 100 100 0 1) SF-ADJUSTMENT "Epaisseur du filet interieur" '(0 0 10 1 1 0 1) SF-ADJUSTMENT "Epaisseur du filet exterieur" '(0 0 10 1 1 0 1) SF-COLOR "Couleur du filet interieur" '(0 0 0) SF-COLOR "Couleur du filet exterieur" '(255 255 255) SF-OPTION "Nettete" '(_"Refocus" _"Unsharp mask") SF-OPTION "Affichage" '(_"Oui" _"Non") )