/usr/share/gimp/2.0/scripts/Eg-AddFilmGrain.scm is in gimp-plugin-registry 7.20140602ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | ;
; Add film grain, 2.8
;
; Martin Egger (martin.egger@gmx.net)
; (C) 2012, Bern, Switzerland
;
; You can find more about adding realistic film grain to BW images at
; http://www.outbackphoto.com/workflow/wf_95/essay.html
;
; This script was tested with Gimp 2.8
;
; New versions will be distributed from http://registry.gimp.org/ only
;
; 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 3 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, see <http://www.gnu.org/licenses>.
;
; Define the function
;
(define (script-fu-Eg-AddFilmGrain InImage InLayer InFlatten InShadCol InShadRad InMid1Blur InMid2Blur InShad1Blur InShad2Blur)
;
; Save history
;
(gimp-image-undo-group-start InImage)
(if (= (car (gimp-drawable-is-rgb InLayer)) FALSE ) (gimp-image-convert-rgb InImage))
(gimp-context-set-foreground '(128 128 128))
;
(let* (
(Midtone1Layer (car (gimp-layer-new InImage (car (gimp-image-width InImage)) (car (gimp-image-height InImage)) RGBA-IMAGE "Noise 1 - midtones" 80 OVERLAY-MODE)))
(Midtone2Layer (car (gimp-layer-new InImage (car (gimp-image-width InImage)) (car (gimp-image-height InImage)) RGBA-IMAGE "Noise 2 - midtones" 80 OVERLAY-MODE)))
(ShadHL1Layer (car (gimp-layer-new InImage (car (gimp-image-width InImage)) (car (gimp-image-height InImage)) RGBA-IMAGE "Noise 1 - shadows" 80 OVERLAY-MODE)))
(ShadHL2Layer (car (gimp-layer-new InImage (car (gimp-image-width InImage)) (car (gimp-image-height InImage)) RGBA-IMAGE "Noise 2 - shadows" 80 OVERLAY-MODE)))
)
(gimp-drawable-fill Midtone1Layer FOREGROUND-FILL)
(gimp-drawable-fill Midtone2Layer FOREGROUND-FILL)
(gimp-drawable-fill ShadHL1Layer FOREGROUND-FILL)
(gimp-drawable-fill ShadHL2Layer FOREGROUND-FILL)
(gimp-image-insert-layer InImage Midtone1Layer 0 -1)
(gimp-image-insert-layer InImage Midtone2Layer 0 -1)
(gimp-image-insert-layer InImage ShadHL1Layer 0 -1)
(gimp-image-insert-layer InImage ShadHL2Layer 0 -1)
;
(plug-in-hsv-noise TRUE InImage Midtone1Layer 2 0 0 100)
(plug-in-hsv-noise TRUE InImage Midtone2Layer 2 0 0 100)
;
(gimp-context-set-antialias TRUE)
(gimp-context-set-feather TRUE)
(gimp-context-set-feather-radius 3 3)
(gimp-context-set-sample-merged TRUE)
(gimp-image-select-color InImage CHANNEL-OP-REPLACE InLayer InShadCol)
(plug-in-hsv-noise TRUE InImage ShadHL1Layer 2 0 0 100)
(plug-in-hsv-noise TRUE InImage ShadHL2Layer 2 0 0 100)
(gimp-selection-none InImage)
;
(plug-in-gauss TRUE InImage Midtone1Layer InMid1Blur InMid1Blur TRUE)
(plug-in-gauss TRUE InImage Midtone2Layer InMid2Blur InMid2Blur TRUE)
(plug-in-gauss TRUE InImage ShadHL1Layer InShad1Blur InShad1Blur TRUE)
(plug-in-gauss TRUE InImage ShadHL2Layer InShad2Blur InShad2Blur TRUE)
;
; Flatten the image, if we need to
;
(cond
((= InFlatten TRUE)
(begin
(gimp-image-merge-down InImage Midtone1Layer CLIP-TO-IMAGE)
(gimp-image-merge-down InImage Midtone2Layer CLIP-TO-IMAGE)
(gimp-image-merge-down InImage ShadHL1Layer CLIP-TO-IMAGE)
(gimp-image-merge-down InImage ShadHL2Layer CLIP-TO-IMAGE)
)
)
((= InFlatten FALSE)
(begin
(gimp-image-set-active-layer InImage InLayer)
)
)
)
)
;
; Finish work
;
(gimp-image-undo-group-end InImage)
(gimp-displays-flush)
;
)
;
(script-fu-register
"script-fu-Eg-AddFilmGrain"
_"Add film grain"
"Add realistic film grain to BW images"
"Martin Egger (martin.egger@gmx.net)"
"Martin Egger, Bern, Switzerland"
"29.02.2012"
"RGB* GRAY*"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
SF-TOGGLE "Flatten Image" FALSE
SF-COLOR "Shadow Color" '(35 35 35)
SF-ADJUSTMENT "Shadow Selection Range" '(50.0 1.0 100.0 1.0 0 2 0)
SF-ADJUSTMENT "Midtone 1 Blur Radius" '(3.0 0.5 50.0 0.5 0 2 0)
SF-ADJUSTMENT "Midtone 2 Blur Radius" '(1.5 0.5 10.0 0.5 0 2 0)
SF-ADJUSTMENT "Shadow 1 Blur Radius" '(3.0 0.5 50.0 0.5 0 2 0)
SF-ADJUSTMENT "Shadow 2 Blur Radius" '(1.5 0.5 10.0 0.5 0 2 0)
)
;
(script-fu-menu-register "script-fu-Eg-AddFilmGrain"
"<Image>/Filters/Noise")
;
|