(define (script-fu-my_print_workflow image drawable format dpi Nettete) (if (= format 0) (begin (set! thePaperWidth 210) (set! thePaperHeight 297) ) (begin (set! thePaperWidth 329) (set! thePaperHeight 483) ) ) (set! thePaperRatio (/ thePaperHeight thePaperWidth)) (set! theImageWidth (car (gimp-image-width image))) (set! theImageHeight (car (gimp-image-height image))) (if (>= theImageWidth theImageHeight) (begin (set! theTempWidht theImageHeight) (set! theTempHeight theImageWidth) ) (begin (set! theTempWidht theImageWidth) (set! theTempHeight theImageHeight) ) ) (set! theTempRatio (/ theTempHeight theTempWidht)) (if (<= theTempRatio thePaperRatio) (begin (set! theTempFactor (/ thePaperWidth theTempWidht)) ) (begin (set! theTempFactor (/ thePaperHeight theTempHeight)) ) ) (set! theFactor (* theTempFactor (/ dpi 25.4))) (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 ; (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))) ; ; L'image est aplatie puis enfin affichée ; (set! theNewImageLayer (car (gimp-image-flatten theNewImage))) (gimp-display-new theNewImage) ) (script-fu-register "script-fu-my_print_workflow" "/Script-Fu/Utils/My Print Workflow..." "Workflow de traitement pour impression sur A4 ou A3+ avec un redimensionnement et une resolution donnes et ajout de nettete au resultat" "Stephan Peccini (stephan@photonature.fr)" "Stephan Peccini" "April 2005" "RGB* GRAY*" SF-IMAGE "Input Image" 0 SF-DRAWABLE "Input Drawable" 0 SF-OPTION "Format" '(_"A4" _"A3+") SF-ADJUSTMENT "Dpi" '(300 150 300 50 50 0 1) SF-OPTION "Nettete" '(_"Refocus" _"Unsharp mask") )