PDA

Vollständige Version anzeigen : Skripte: SW und Tonung


Eg
20.10.2007, 16:57
Hallo

nachdem sich GIMP 2.4 langsam der Fertigstellung nähert, hier zwei meiner Skripte in den neuen Versionen. Die Veröffentlichung auf registry.gimp.org folgt dann später.

Das erste Skript ermöglicht die S/W-Umwandlung mit div. Filtern. Das zweite erlaubt, S/W-Bilder mit einer Tonung zu versehen.

Kommentare und Verbesserungsvorschläge sind natürlich willkommen.

Viel Spass
Martin

;

; Black & White, V2.4

;

; Martin Egger (martin.egger@gmx.net)

; (C) 2007, Bern, Switzerland

;

; You can find more about simulating BW at

; http://epaperpress.com/psphoto/ or http://www.thelightsrightstudio.com

;

; This plugin was tested with Gimp 2.4

;

; 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-Eg-Black&White InImage InLayer InType InFlatten)

;

; Save history

;

(gimp-image-undo-group-start InImage)

;

(let* (

(BWLayer (car (gimp-layer-copy InLayer TRUE)))

)

(gimp-image-add-layer InImage BWLayer -1)

;

; Select conversion type

;

(cond

;
; B&W (No Filter)

;

((= InType 0) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.45 0.35 0.3 0 0 0 0 0 0))

;

; B&W with Red filter

;

((= InType 1) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 1.0 0.15 -0.15 0 0 0 0 0 0))

;

; B&W with Green Filter

;

((= InType 2) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.35 0.55 0.2 0 0 0 0 0 0))

;

; B&W with Blue Filter

;

((= InType 3) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.15 0.15 0.8 0 0 0 0 0 0))
;

; B&W with Yellow filter

;

((= InType 4) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.6 0.3 0.10 0 0 0 0 0 0))

;

; B&W with Orange filter

;

((= InType 5) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.75 0.2 0.2 0 0 0 0 0 0))

;

; B&W with Yellow-Green filter

;

((= InType 6) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.25 0.65 0.15 0 0 0 0 0 0))

;

; B&W (Lithographic film)

;

((= InType 7)

(begin

(plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.4 0.3 0.3 0 0 0 0 0 0)

(gimp-brightness-contrast BWLayer 0 110)

)

)

;

; B&W (Orthochromatic film)

;

((= InType 8) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE -1.1 1.05 1.05 0 0 0 0 0 0))

;

; B&W (High Contrast)

;

((= InType 9) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 1.7 -0.1 -0.6 0 0 0 0 0 0))

;

; B&W (Landscape)

;

((= InType 10) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.1 1.3 -0.35 0 0 0 0 0 0))

;

; B&W (Portrait)

;

((= InType 11) (plug-in-colors-channel-mixer TRUE InImage BWLayer TRUE 0.55 0.3 0.25 0 0 0 0 0 0))

;

; B&W (Gimp Desaturate)

;

((= InType 12) (gimp-desaturate BWLayer))

)

;

; Flatten the image, if we need to

;

(cond

((= InFlatten TRUE) (gimp-image-merge-down InImage BWLayer CLIP-TO-IMAGE))

((= InFlatten FALSE)

(begin

(gimp-drawable-set-name BWLayer "BlackWhite")

(gimp-image-set-active-layer InImage InLayer)

)

)

)

)

;

; Finish work

;

(gimp-image-undo-group-end InImage)

(gimp-displays-flush)

;

)

;

; Register the function with the GIMP

;

(script-fu-register

"script-fu-Eg-Black&White"

_"Black and _White"

"Black and White conversions"

"Martin Egger (martin.egger@gmx.net)"

"Martin Egger, Bern, Switzerland"

"20.10.2007"

"RGB*"

SF-IMAGE "The Image" 0

SF-DRAWABLE "The Layer" 0

SF-OPTION "Which B&W conversion"

'(

"B&W (No Filter)"

"B&W + RED filter"

"B&W + GREEN filter"
"B&W + BLUE filter"
"B&W + YELLOW filter"
"B&W + ORANGE filter"

"B&W + YELLOW-GREEN filter"

"B&W (Lithographic film)"

"B&W (Orthochromatic film)"

"B&W (High Contrast)"
"B&W (Landscape)"
"B&W (Portrait)"
"B&W (GIMP Desaturate)"
)

SF-TOGGLE "Flatten Image" FALSE

)

;

(script-fu-menu-register "script-fu-Eg-Black&White"
"<Image>/Filters/Eg")

;


;

; Duotone/Tritone Simulation, V2.4

;

; Martin Egger (martin.egger@gmx.net)

; (C) 2007, Bern, Switzerland

;

; You can find more about toning at

; http://www.gimp.org/tutorials/Sepia_Toning/

;

; This plugin was tested with Gimp 2.4

;

; 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 the function

;

(define (script-fu-Eg-DuotoneSimulation InImage InLayer InType InColor InFlatten)

;

; Save history

;

(gimp-image-undo-group-start InImage)

(if (= (car (gimp-drawable-is-rgb InLayer)) FALSE ) (gimp-image-convert-rgb InImage))

;

(let* (
(TintLayer (car (gimp-layer-new InImage (car (gimp-image-width InImage)) (car (gimp-image-height InImage)) RGBA-IMAGE "Tint" 70.0 OVERLAY-MODE)))

(Old-FG-Color (car (gimp-context-get-foreground)))
)

;

; Select the tint color

;

(cond

;

; Cyano

;

((= InType 0) (gimp-context-set-foreground '(20 120 180)))

;

; Gold

;

((= InType 1)
(begin
(gimp-context-set-foreground '(250 145 55))
(gimp-layer-set-opacity TintLayer 55)
)
)

;

; Palladium (Yellow)

;

((= InType 2) (gimp-context-set-foreground '(143 153 69)))

;

; Selenium (Magenta)

;

((= InType 3)
(begin
(gimp-context-set-foreground '(158 79 104))

(gimp-layer-set-opacity TintLayer 60)
)
)
;

; Sepia

;

((= InType 4) (gimp-context-set-foreground '(215 175 110)))

;

; Silver

;

((= InType 5)
(begin
(gimp-context-set-foreground '(92 153 154))
(gimp-layer-set-opacity TintLayer 55)
)
)

;

; Cooler

;

((= InType 6) (gimp-context-set-foreground '(150 150 175)))
;

; Warmer

;

((= InType 7) (gimp-context-set-foreground '(180 170 150)))

;

; Selection

;

((= InType 8) (gimp-context-set-foreground InColor))

)

;

; Fill the layer with the tint

;

(gimp-drawable-fill TintLayer FOREGROUND-FILL)

;

; Add the layer to the image

;

(gimp-image-add-layer InImage TintLayer -1)

;

; Create a mask for the new layer

;

(let* (

(TintMask (car (gimp-layer-create-mask TintLayer ADD-WHITE-MASK)))

)

(gimp-layer-add-mask TintLayer TintMask)

(gimp-selection-all InImage)

(gimp-edit-copy InLayer)

(gimp-floating-sel-anchor (car (gimp-edit-paste TintMask TRUE)))

(gimp-invert TintMask)

(gimp-layer-set-edit-mask TintLayer FALSE)
)
;

; Flatten the image, if we need to

;

(cond

((= InFlatten TRUE) (gimp-image-merge-down InImage TintLayer CLIP-TO-IMAGE))

((= InFlatten FALSE)

(begin

(gimp-image-set-active-layer InImage InLayer)

)

)

)

(gimp-context-set-foreground Old-FG-Color)

)

;

; Finish work

;

(gimp-image-undo-group-end InImage)

(gimp-displays-flush)

;

)

;

; Register the function with the GIMP

;

(script-fu-register

"script-fu-Eg-DuotoneSimulation"

_"_Duotone Simulation"

"Simulate Duotones in GIMP"

"Martin Egger (martin.egger@gmx.net)"

"Martin Egger, Bern, Switzerland"

"20.10.2007"

"RGB* GRAY*"

SF-IMAGE "The Image" 0

SF-DRAWABLE "The Layer" 0

SF-OPTION "Select Tone"

'(

"Cyano"
"Gold"

"Palladium (Yellow)"

"Selenium (Magenta)"

"Sepia"

"Silver"
"Cooler look"
"Warmer look"

"Color from selection"

)
SF-COLOR "Select Color" '(215 175 110)

SF-TOGGLE "Flatten Image" FALSE

)

;

(script-fu-menu-register "script-fu-Eg-DuotoneSimulation"
"<Image>/Filters/Eg")

;

houz
21.10.2007, 14:23
Schön, dass du dir solche Mühe machst. Wie wäre es mit einem Beispiel?

Eg
21.10.2007, 20:12
OK, hier mal zwei Übersichten, welche die verschiedenen Einstellungen der beiden Skripte aufzeigen.

S/W-Umwandlung:

http://img228.imageshack.us/img228/4203/swtestsyh5.th.jpg (http://img228.imageshack.us/my.php?image=swtestsyh5.jpg)

Duotone:

Die Stärke der Tonung kann durch Änderung der Deckkraft der Ebene angepasst werden.

http://img75.imageshack.us/img75/209/duotestwj9.th.jpg (http://img75.imageshack.us/my.php?image=duotestwj9.jpg)

Martin

Egin
01.01.2008, 13:45
sieht interessant aus!
wie kann ich das script denn einfügen?

The Jackal
01.01.2008, 17:03
Du speicherst das Skript als .scm und legst es in einen beliebigen Ordner, der unter Datei > Einstellungen > Ordner > Skripte aufgeführt ist.

losti
02.01.2008, 21:28
Und für Leute wie mich... wie speicher ich das genau xD?
Einfach Text kopieren, in einen text editor und dann als .scm speichern, geht das, oder muss man das anders machen ^_^?

mfg losti

MichaJo
02.01.2008, 21:44
Einfach Text kopieren, in einen text editor und dann als .scm speichern?

Ja, genau so.


Gruß

Micha

losti
02.01.2008, 23:37
ok, danke = ]