diff options
-rw-r--r-- | 3.0/przem-apply-sepia-v3.scm | 103 | ||||
-rw-r--r-- | changelog.md | 3 |
2 files changed, 67 insertions, 39 deletions
diff --git a/3.0/przem-apply-sepia-v3.scm b/3.0/przem-apply-sepia-v3.scm index 0bf7961..6545787 100644 --- a/3.0/przem-apply-sepia-v3.scm +++ b/3.0/przem-apply-sepia-v3.scm @@ -1,10 +1,24 @@ ; przem-apply-sepia-v3 - Script-fu dodający prawdziwą sepie do zdjęcia ; author: PRP -; licencja: Public Doimain +; licencja: GPL v3 ; Gdańsk - 07-02-2025 ; ver. 2.2502019-0~alpha for GIMP 3 +; +; 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 <https://www.gnu.org/licenses/>. +; -(define (przem-apply-sepia-v3 image drawable value-slider-sepia shadow-sepia gradient-reverse gradient-shape) +(define (przem-apply-sepia-v3 image drawable value-slider-sepia shadow-sepia gradient-reverse gradient-shape in-sepia) (let* ( (image-width (car (gimp-image-get-width image))) (image-height (car (gimp-image-get-height image))) @@ -12,7 +26,6 @@ (type (car (gimp-drawable-type layer))) (center-x (/ image-width 2)) (center-y (/ image-height 2)) - (sepia-layer (car (gimp-layer-new image "Sepia" image-width image-height RGB-IMAGE 100 LAYER-MODE-NORMAL))) (radius (sqrt (+ (* center-x center-x) (* center-y center-y)))) (the-layer 0) ) @@ -32,59 +45,70 @@ (set! the-layer (car (gimp-image-flatten image))) ; Konwersja obrazu do skali szarości - ; TODO - po aktualizacji GIMPa wyłączyć warunek - (if (= type RGB-IMAGE) - (gimp-drawable-desaturate the-layer DESATURATE-LIGHTNESS)) + ;(if (= type RGB-IMAGE) + ;(gimp-drawable-desaturate the-layer DESATURATE-LIGHTNESS) + ;) + + (if (= in-sepia TRUE) + (begin (gimp-drawable-desaturate the-layer DESATURATE-LIGHTNESS) + (gimp-drawable-brightness-contrast the-layer -0.078125 -0.15625) + (gimp-drawable-color-balance the-layer TRANSFER-SHADOWS TRUE 30 0 -30) + ) + ) - (gimp-context-set-foreground '(112 66 20)) ; sepia ciemniejszy - (gimp-context-set-background '(233 213 186)) ; sepia jasniejszy - ;(gimp-context-set-background '(210 180 140)) ; sepia jasniejsza - - ; Dodanie koloru sepii - (gimp-image-insert-layer image sepia-layer 0 -1) + (let ( + (sepia-layer (car (gimp-layer-new image "Sepia" image-width image-height RGB-IMAGE 100 LAYER-MODE-NORMAL))) + ) + + (gimp-context-set-foreground '(112 66 20)) ; sepia ciemniejszy + (gimp-context-set-background '(233 213 186)) ; sepia jasniejszy + ;(gimp-context-set-background '(210 180 140)) ; sepia jasniejsza + + ; Dodanie koloru sepii + (gimp-image-insert-layer image sepia-layer 0 -1) - (gimp-context-push) + (gimp-context-push) - ;(plug-in-checkerboard #:run-mode RUN-NONINTERACTIVE - ; #:image image - ; #:drawables (vector drawable) - ; #:psychobilly 0 - ; #:check-size 8) - (plug-in-checkerboard RUN-NONINTERACTIVE image (vector sepia-layer) 0 8) + ;(plug-in-checkerboard #:run-mode RUN-NONINTERACTIVE + ; #:image image + ; #:drawables (vector drawable) + ; #:psychobilly 0 + ; #:check-size 8) + (plug-in-checkerboard RUN-NONINTERACTIVE image (vector sepia-layer) 0 8) - (gimp-context-pop) + (gimp-context-pop) - (gimp-context-push) + (gimp-context-push) - ;(gimp-selection-all image) - ; tak było w v. 2.10 - ;(gimp-edit-blend sepia-layer FG-BG-RGB-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE TRUE 3 0 TRUE 0 0 image-width image-height) - (if (= gradient-shape TRUE) - (begin - (gimp-context-set-gradient-reverse gradient-reverse) - (gimp-drawable-edit-gradient-fill sepia-layer + ;(gimp-selection-all image) + ; tak było w v. 2.10 + ;(gimp-edit-blend sepia-layer FG-BG-RGB-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE TRUE 3 0 TRUE 0 0 image-width image-height) + (if (= gradient-shape TRUE) + (begin + (gimp-context-set-gradient-reverse gradient-reverse) + (gimp-drawable-edit-gradient-fill sepia-layer GRADIENT-LINEAR (- 100 shadow-sepia) FALSE 1 0 TRUE 0 0 image-width image-height) - ) - (begin - (gimp-context-set-gradient-reverse gradient-reverse) - (gimp-drawable-edit-gradient-fill sepia-layer + ) + (begin + (gimp-context-set-gradient-reverse gradient-reverse) + (gimp-drawable-edit-gradient-fill sepia-layer GRADIENT-SHAPEBURST-DIMPLED (- 100 shadow-sepia) FALSE 1 0 TRUE 0 0 center-x center-y) - ) ) + ) ) - (gimp-context-pop) + (gimp-context-pop) - ; Zmiana krycia warstwy - (gimp-layer-set-opacity sepia-layer value-slider-sepia) - - (gimp-image-merge-down image sepia-layer CLIP-TO-IMAGE) + ; Zmiana krycia warstwy + (gimp-layer-set-opacity sepia-layer value-slider-sepia) + (gimp-image-merge-down image sepia-layer CLIP-TO-IMAGE) + ) ; let (gimp-selection-none image) @@ -98,7 +122,7 @@ _"_Apply a sepia effect to the image" _"Tworzy obraz sepii" "Przemyslaw R. Pietraszczyk" - "Public Domain" + "GPL v3" "2025-02-07" "RGB* GRAY*" SF-ONE-OR-MORE-DRAWABLE @@ -106,6 +130,7 @@ SF-ADJUSTMENT _"Shadow Sepia" '(30 0 100 1 10 0 0) ; Suwak poziomy SF-TOGGLE _"Gradient reverse" FALSE SF-TOGGLE _"Shape" TRUE + SF-TOGGLE _"Sepia" TRUE ) diff --git a/changelog.md b/changelog.md index bb9d069..625b4bd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# [2.25021=20-0] przem-apply-sepia-v3.scm
+* Przeniesienie 'gimp-layer-new' do wewnątrz skryptu - desaturate dalej zwraca błąd przy zdjęciach monochromatycznych
+
# [2.250219-1] przem-apply-sepia-v3.scm
* Dodanie 'gimp-image-flatten', bez efektu
|