1;;; The GIMP -- an image manipulation program
2;;; Copyright (C) 1995 Spencer Kimball and Peter Mattis
3;;;
4;;; script-fu-low-contrast-preset
5;;; Loads a PNG, makes it low contrast, saves it
6;;; Copyright (c) 2002 Guillermo S. Romero
7;;; famrom infernal-iceberg.com
8;;;
9;;; ### License  ###
10;;;
11;;; This program is free software; you can redistribute it and/or modify
12;;; it under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 2 of the License, or
14;;; (at your option) any later version.
15;;;
16;;; This program is distributed in the hope that it will be useful,
17;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19;;; GNU General Public License for more details.
20;;;
21;;; You can get a copy of the GNU General Public License from
22;;; http://www.gnu.org/, the site of the Free Software Foundation, Inc.
23;;;
24;;; ### Versions ###
25;;;
26;;; 1.00.00 Initial release
27;;; 1.00.01 Fixed typo
28;;;
29;;; ### Inline Documentation ###
30;;;
31;;; # Intro #
32;;; Some people have eye problems and require low contrast images.
33;;; This script helps converting normal icons to low contrast, great for
34;;; those persons and for developers that want to ship special icon sets.
35;;;
36;;; # Full usage #
37;;; Place low-contrast-preset.scm in the GIMP script dir, for example
38;;; ~/.gimp-1.2/scripts/.
39;;; Next copy all the icons to somewhere (so you keep the originals)
40;;; and there:
41;;; for i in *.png
42;;; do
43;;;     gimp -i -s -b "(script-fu-low-contrast-preset \"${PWD}${i}\")" \
44;;;                   "(gimp-quit 0)"
45;;; done
46;;; It will take a while and must be run from inside a X11 session
47;;; (Xnest and Xvfb are ok) if you are using GIMP 1.2.
48;;;
49;;; # Requirements #
50;;; This plugin was developed with Gimp 1.2.3 CVS
51;;; Check all your plugins and scripts in the DB Browser before reporting bugs
52;;;
53;;; # Parameters #
54;;; filename: a path to a PNG, like default vale
55;;;
56;;; # Debugging and to-do #
57;;; Look for ";; @" comments
58
59;; The function, hardcoded values for now
60(define (script-fu-low-contrast-preset filename)
61
62  (let* ((image (car (file-png-load 1 filename filename)))
63         (drawable (car (gimp-image-active-drawable image))))
64    (gimp-levels drawable 0 0 255 1.0 125 175)
65    (file-png-save 1 image drawable filename filename 0 9 0 0 0 1 1)))
66
67;; Register!
68(script-fu-register "script-fu-low-contrast-preset"
69		    "<Toolbox>/Xtns/Script-Fu/Misc/Low contrast PNG icon preset..."
70		    "Loads a PNG, makes it low contrast, saves it"
71		    "Guillermo S. Romero"
72		    "2002 Guillermo S. Romero"
73		    "2002-09-12"
74		    ""
75		    SF-FILENAME "PNG to modify" "/tmp/icon.png")
76