/usr/share/gimp/2.0/scripts/neumann-slide.scm is in gimp-plugin-registry 7.20140602ubuntu3.
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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | ;
; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; Slide maker script for GIMP 2.4
;Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
;
; Tags: photo, decor, slide
;
; Author statement:
; makes your picture look like a slide
;
; The script works on RGB and grayscale images that contain only
; one layer. The image is cropped to fit into an aspect ratio of 1:1,5.
; It creates a copy of the image or can optionally work on the original.
; The script uses the current background color to create a background
; layer.
;
;
; --------------------------------------------------------------------
; Distributed by Gimp FX Foundry project
; --------------------------------------------------------------------
; - Changelog -
; 0.20 - first public release
; 0.30 - some code cleanup
; now uses the rotate plug-in to improve speed
; 0.40 - changes to work with gimp-1.1
; if the image was rotated, rotate the whole thing back when finished
; 0.41 - changes to work with gimp-2.0, slightly correct text offsets,
; Nils Philippsen <nphilipp@redhat.com> 2004/03/28
;
; !still in development!
; TODO: - change the script so that the film is rotated, not the image
; - antialiasing
; - make 'add background' an option
; - ?
; Updated for GIMP 2.4 by Paul Sherman
; --------------------------------------------------------------------
;
; 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.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (script-fu-slide img
drawable
text
number
fontname
font-color
work-on-copy)
(define (crop width height ratio)
(if (>= width (* ratio height))
(* ratio height)
width
)
)
(let* (
(type (car (gimp-drawable-type-with-alpha drawable)))
(image (cond ((= work-on-copy TRUE)
(car (gimp-image-duplicate img)))
((= work-on-copy FALSE)
img)))
(owidth (car (gimp-image-width image)))
(oheight (car (gimp-image-height image)))
(ratio (if (>= owidth oheight) (/ 3 2)
(/ 2 3)))
(crop-width (crop owidth oheight ratio))
(crop-height (/ crop-width ratio))
(width (* (max crop-width crop-height) 1.05))
(height (* (min crop-width crop-height) 1.5))
(hole-width (/ width 20))
(hole-space (/ width 8))
(hole-height (/ width 12))
(hole-radius (/ hole-width 4))
(hole-start (- (/ (rand 1000) 1000) 0.5))
(film-layer (car (gimp-layer-new image
width
height
type
_"Film"
100
NORMAL-MODE)))
(bg-layer (car (gimp-layer-new image
width
height
type
_"Background"
100
NORMAL-MODE)))
(pic-layer (car (gimp-image-get-active-drawable image)))
(numbera (string-append number "A"))
)
(gimp-context-push)
(gimp-image-undo-disable image)
; add an alpha channel to the image
(gimp-layer-add-alpha pic-layer)
; crop, resize and eventually rotate the image
(gimp-image-crop image
crop-width
crop-height
(/ (- owidth crop-width) 2)
(/ (- oheight crop-height) 2))
(gimp-image-resize image
width
height
(/ (- width crop-width) 2)
(/ (- height crop-height) 2))
(if (< ratio 1)
(plug-in-rotate 1 image pic-layer 1 FALSE)
)
; add the background layer
(gimp-drawable-fill bg-layer BACKGROUND-FILL)
(gimp-image-add-layer image bg-layer -1)
; add the film layer
(gimp-context-set-background '(0 0 0))
(gimp-drawable-fill film-layer BACKGROUND-FILL)
(gimp-image-add-layer image film-layer -1)
; add the text
(gimp-context-set-foreground font-color)
(gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer
(+ hole-start (* -0.25 width))
(* 0.01 height)
text
0
TRUE
(* 0.040 height) PIXELS fontname)))
(gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer
(+ hole-start (* 0.75 width))
(* 0.01 height)
text
0
TRUE
(* 0.040 height) PIXELS
fontname )))
(gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer
(+ hole-start (* 0.35 width))
0.0
number
0
TRUE
(* 0.050 height) PIXELS
fontname )))
(gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer
(+ hole-start (* 0.35 width))
(* 0.94 height)
number
0
TRUE
(* 0.050 height) PIXELS
fontname )))
(gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer
(+ hole-start (* 0.85 width))
(* 0.945 height)
numbera
0
TRUE
(* 0.045 height) PIXELS
fontname )))
; create a mask for the holes and cut them out
(let* (
(film-mask (car (gimp-layer-create-mask film-layer ADD-WHITE-MASK)))
(hole hole-start)
(top-y (* height 0.06))
(bottom-y (* height 0.855))
)
(gimp-layer-add-mask film-layer film-mask)
(gimp-selection-none image)
(while (< hole 8)
(gimp-rect-select image
(* hole-space hole)
top-y
hole-width
hole-height
CHANNEL-OP-ADD
FALSE
0)
(gimp-rect-select image
(* hole-space hole)
bottom-y
hole-width
hole-height
CHANNEL-OP-ADD
FALSE
0)
(set! hole (+ hole 1))
)
(gimp-context-set-foreground '(0 0 0))
(gimp-edit-fill film-mask BACKGROUND-FILL)
(gimp-selection-none image)
(plug-in-gauss-rle 1 image film-mask hole-radius TRUE TRUE)
(gimp-threshold film-mask 127 255)
(gimp-layer-remove-mask film-layer MASK-APPLY)
)
; reorder the layers
(gimp-image-raise-layer image pic-layer)
(gimp-image-raise-layer image pic-layer)
; eventually rotate the whole thing back
(if (< ratio 1)
(plug-in-rotate 1 image pic-layer 3 TRUE)
)
; clean up after the script
(gimp-selection-none image)
(gimp-image-undo-enable image)
(if (= work-on-copy TRUE)
(gimp-display-new image)
)
(gimp-displays-flush)
(gimp-context-pop)
)
)
(script-fu-register "script-fu-slide"
_"_Slide..."
_"Add a slide-film like frame, sprocket holes, and labels to an image"
"Sven Neumann <sven@gimp.org>"
"Sven Neumann"
"2004/03/28"
"RGB GRAY"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-STRING _"Text" "GIMP"
SF-STRING _"Number" "32"
SF-FONT _"Font" "Serif"
SF-COLOR _"Font color" '(255 180 0)
SF-TOGGLE _"Work on copy" TRUE
)
(script-fu-menu-register "script-fu-slide"
"<Image>/FX-Foundry/Image Effects")
|