home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / Topware / gimp / gimp-setup-20001226.exe / Main / old_photo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2000-12-27  |  3.3 KB  |  96 lines

  1. ;
  2. ; old-photo
  3. ;
  4. ;
  5. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  6. ; At ECS Dept, University of Southampton, England.
  7.  
  8. ; This program is free software; you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 2 of the License, or
  11. ; (at your option) any later version.
  12. ; This program is distributed in the hope that it will be useful,
  13. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ; GNU General Public License for more details.
  16. ; You should have received a copy of the GNU General Public License
  17. ; along with this program; if not, write to the Free Software
  18. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. ; Define the function:
  21.  
  22. (define (script-fu-old-photo inImage inLayer inDefocus inBorder inSepia inMottle inCopy)
  23.         (gimp-selection-all inImage)
  24.         (set! theImage (if (= inCopy TRUE)
  25.                        (car (gimp-channel-ops-duplicate inImage))
  26.                        inImage)
  27.         )
  28.  
  29.     (set! theLayer (car(gimp-image-flatten theImage)))
  30.         (if (= inDefocus TRUE)
  31.             (plug-in-gauss-rle TRUE theImage theLayer 1.5 TRUE TRUE)
  32.             ()
  33.         )
  34.         (if (= inBorder TRUE)
  35.             (script-fu-fuzzy-border theImage inLayer '(255 255 255)
  36.                 20 TRUE 8 FALSE 100 FALSE TRUE )
  37.             ()
  38.         )
  39.     (set! theLayer (car(gimp-image-flatten theImage)))
  40.  
  41.     (if (= inSepia TRUE)
  42.             (begin (gimp-desaturate theLayer)
  43.                (gimp-brightness-contrast theLayer -20 -40)
  44.                (gimp-color-balance theLayer 0 TRUE 30 0 -30)
  45.             )
  46.             ()
  47.         )
  48.         (set! theWidth (car (gimp-image-width theImage)))
  49.         (set! theHeight (car (gimp-image-height theImage)))
  50.     (if (= inMottle TRUE)
  51.             (begin (set! mLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "Mottle" 100 DARKEN-ONLY)))
  52.                               
  53.                    (gimp-image-add-layer theImage mLayer 0)
  54.                    (gimp-selection-all theImage)
  55.                    (gimp-edit-clear mLayer)
  56.                    (gimp-selection-none theImage)
  57.                    (plug-in-noisify TRUE theImage mLayer TRUE 0 0 0 0.5)
  58.                    (plug-in-gauss-rle TRUE theImage mLayer 5 TRUE TRUE)
  59.                (set! theLayer (car(gimp-image-flatten theImage)))
  60.             )
  61.             ()
  62.         )
  63.  
  64.  
  65.  
  66.         (if     (= inCopy TRUE)
  67.                 (begin  (gimp-image-clean-all theImage)
  68.                         (gimp-display-new theImage)
  69.                 )
  70.                 ()
  71.         )
  72.         (gimp-selection-none inImage)
  73.     (gimp-displays-flush theImage)
  74. )
  75.  
  76. ; Register the function with the GIMP:
  77.  
  78. (script-fu-register
  79.     "script-fu-old-photo"
  80.     _"<Image>/Script-Fu/Decor/Old Photo..."
  81.     "Makes the image look like an old photo"
  82.     "Chris Gutteridge"
  83.     "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  84.     "16th April 1998"
  85.     "RGB* GRAY*"
  86.     SF-IMAGE "The Image" 0
  87.     SF-DRAWABLE "The Layer" 0
  88.     SF-TOGGLE _"Defocus" TRUE
  89.     SF-TOGGLE _"Border" TRUE
  90.     SF-TOGGLE _"Sepia" TRUE
  91.     SF-TOGGLE _"Mottle" FALSE
  92.     SF-TOGGLE _"Work on Copy" TRUE
  93. )
  94.