;; Functions to create spline curves to send to gimp-curves-spline (define (set-pt a index x y) (prog1 (aset a (* index 2) x) (aset a (+ (* index 2) 1) y))) (define (gen-points num_points x1 y1 x2 y2 x3 y3 x4 y4) (let* ((a (cons-array (* num_points 2) 'byte))) (set-pt a 0 x1 y1) (set-pt a 1 x2 y2) (set-pt a 2 x3 y3) (if (= num_points 4) (set-pt a 3 x4 y4)) a)) (define (fix-black img drawable) (gimp-image-undo-group-start img) (gimp-curves-spline drawable 0 6 (gen-points 3 12 0 127 127 243 255 0 0)) (gimp-image-undo-group-end img) (gimp-displays-flush) ) (define (fix-green-cast img drawable) (gimp-image-undo-group-start img) (gimp-curves-spline drawable 1 8 (gen-points 4 0 0 114 119 219 210 255 255)) (gimp-curves-spline drawable 2 8 (gen-points 4 0 0 97 99 218 208 255 255)) (gimp-curves-spline drawable 3 8 (gen-points 4 0 0 96 96 214 219 255 255)) (gimp-image-undo-group-end img) (gimp-displays-flush) (gimp-message "Correct the levels now, if you like. The image is now ready for printing on a Fuji Frontier or other photographic printing machine.") ) (define (remove-haze img drawable) (gimp-image-undo-group-start img) (plug-in-unsharp-mask 1 img drawable 60 0.30 1) (gimp-image-undo-group-end img) (gimp-displays-flush) ) (define (sharpen-lab-mode img drawable) (gimp-image-undo-group-start img) (let* ( (original-layers (cadr (gimp-image-get-layers img))) ) ; split to L*a*b* (set! lab-image (car (plug-in-decompose TRUE img drawable "LAB" TRUE))) (set! lab-layers (cadr (gimp-image-get-layers lab-image))) ; blur A & B layers (plug-in-gauss-iir2 TRUE lab-image (aref lab-layers 0) 3 3) (plug-in-gauss-iir2 TRUE lab-image (aref lab-layers 1) 3 3) ; sharpen L layer (plug-in-unsharp-mask TRUE lab-image (aref lab-layers 2) 3 0.50 3) ; compose L*a*b* (set! result-image (car (plug-in-drawable-compose TRUE 0 (aref lab-layers 2) (aref lab-layers 1) (aref lab-layers 0) 0 "LAB"))) (set! result-layers (cadr (gimp-image-get-layers result-image))) (gimp-edit-copy (aref result-layers 0)) (gimp-image-delete lab-image) (gimp-image-delete result-image) ;(gimp-floating-sel-anchor (car (gimp-edit-paste (aref original-layers 0) FALSE))) (gimp-floating-sel-to-layer (car (gimp-edit-paste (aref original-layers 0) FALSE))) (gimp-image-undo-group-end img) (gimp-displays-flush) ) ) (script-fu-register "fix-black" "/Workflow/Shudder's Digital Darkroom/01 - Correct blacks" "Sets curves to create true blacks." "Steve Crane" "Copyright 2004, Steve Crane" "15 August 2004" "RGB* GRAY*" SF-IMAGE "Image" 0 SF-DRAWABLE "Layer to apply curves to" 0 ) (script-fu-register "fix-green-cast" "/Workflow/Shudder's Digital Darkroom/02 - Correct green cast" "Removes the typical Fuji green cast" "Steve Crane" "Copyright 2004, Steve Crane" "15 August 2004" "RGB* GRAY*" SF-IMAGE "Image" 0 SF-DRAWABLE "Layer to apply curves to" 0 ) (script-fu-register "remove-haze" "/Workflow/Shudder's Digital Darkroom/03 - Remove haze" "Runs the unsharp mask filter to remove haze but not do any actual sharpening" "Steve Crane" "Copyright 2004, Steve Crane" "15 August 2004" "RGB* GRAY*" SF-IMAGE "Image" 0 SF-DRAWABLE "Layer to apply USM to" 0 ) (script-fu-register "sharpen-lab-mode" "/Workflow/Shudder's Digital Darkroom/03 - Sharpen" "Decomposes the image to LAB mode, applies sharpening steps to each layer, recomposes and adds the result as a new layer." "Steve Crane" "Copyright 2004, Steve Crane" "15 August 2004" "RGB* GRAY*" SF-IMAGE "Image" 0 SF-DRAWABLE "Layer to sharpen" 0 )