From f13f62dab34b39f1ea35f29fdadbbfba1c7411eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20R=2E=20Pietraszczyk?= Date: Thu, 25 Sep 2025 21:43:34 +0200 Subject: 2.250925-2 --- script-fu/2.10/przem-burlesque-effect.scm | 81 +++++++++++ .../2.10/przem-oldschool-monochrome-photogrphy.scm | 112 +++++++++++++++ script-fu/2.10/przem-true-cyjanotype.scm | 99 +++++++++++++ script-fu/3.0/przem-oldschool-photogrphy-v3.scm | 156 +++++++++++++++++++++ script-fu/changelog.md | 12 ++ 5 files changed, 460 insertions(+) create mode 100644 script-fu/2.10/przem-burlesque-effect.scm create mode 100644 script-fu/2.10/przem-oldschool-monochrome-photogrphy.scm create mode 100644 script-fu/2.10/przem-true-cyjanotype.scm create mode 100644 script-fu/3.0/przem-oldschool-photogrphy-v3.scm (limited to 'script-fu') diff --git a/script-fu/2.10/przem-burlesque-effect.scm b/script-fu/2.10/przem-burlesque-effect.scm new file mode 100644 index 0000000..e488a0e --- /dev/null +++ b/script-fu/2.10/przem-burlesque-effect.scm @@ -0,0 +1,81 @@ +; przem-burlesque-effect - Tworzy efekt burleski na zdjęciu z sepia, winietowaniem +; author: PRP +; licencja: Public Domain +; Gdańsk - 23-09-2025 +; ver. 2.250923-0~beta + +(define (przem-burlesque-effect img drawable size xpos ypos) + (let* ( + (width (car (gimp-image-width img))) + (height (car (gimp-image-height img))) + (old-selection 0) + (layer-copy 0) + (vignette-layer 0) + ;(texture-layer 0) + ) + + ; Zapisz oryginalne zaznaczenie + (set! old-selection (car (gimp-selection-save img))) + + ; Rozpocznij undo group + (gimp-image-undo-group-start img) + + ; Stwórz kopię warstwy + (set! layer-copy (car (gimp-layer-copy drawable TRUE))) + (gimp-image-insert-layer img layer-copy 0 -1) + (gimp-item-set-name layer-copy "Burlesque Effect") + + ; Zastosuj sepia + (gimp-desaturate layer-copy) + (gimp-color-balance layer-copy 0 TRUE 40 0 -40) ; Ciepłe odcienie sepia + + ; Dodaj kontrast + (gimp-levels layer-copy 0 50 200 1.0 0 255) + + ; Stwórz efekt winietowania + (set! vignette-layer (car (gimp-layer-new img width height RGBA-IMAGE "Vignette" 100 DARKEN-ONLY-MODE))) + (gimp-image-insert-layer img vignette-layer 0 -1) + (gimp-context-set-background '(0 0 0)) + (gimp-edit-fill vignette-layer FILL-BACKGROUND) + + ; Utwórz eliptyczne zaznaczenie dla winietowania + (gimp-ellipse-select img (/ width xpos) (/ height ypos) (/ width 2) (/ height 2) CHANNEL-OP-REPLACE TRUE FALSE 0) + + (gimp-selection-feather img size) + ;(gimp-selection-invert img) + ;(gimp-layer-set-opacity vignette-layer 60) + ;(gimp-layer-add-mask vignette-layer (car (gimp-layer-create-mask vignette-layer ADD-SELECTION-MASK))) + (gimp-edit-clear vignette-layer) + + (gimp-selection-none img) + + ; Przywróć oryginalne zaznaczenie + (gimp-selection-load old-selection) + (gimp-image-remove-channel img old-selection) + + (gimp-image-merge-visible-layers img CLIP-TO-IMAGE) + + + ; Zakończ undo group + (gimp-image-undo-group-end img) + (gimp-displays-flush) + ) +) + +(script-fu-register "przem-burlesque-effect" + _"Burlesque Effect" + _"Tworzy efekt burleski na zdjęciu z sepia, winietowaniem" + "PRP" + "Public Domain" + "2025-09-23" + "RGB* GRAY*" + SF-IMAGE "Image" 0 + SF-DRAWABLE "Drawable" 0 + SF-VALUE "Size" "1000" + SF-VALUE "X position" "4" + SF-VALUE "Y position" "4" + +) + +(script-fu-menu-register "przem-burlesque-effect" + "/Filters/PIETRASZCZYK/") diff --git a/script-fu/2.10/przem-oldschool-monochrome-photogrphy.scm b/script-fu/2.10/przem-oldschool-monochrome-photogrphy.scm new file mode 100644 index 0000000..b7e57bf --- /dev/null +++ b/script-fu/2.10/przem-oldschool-monochrome-photogrphy.scm @@ -0,0 +1,112 @@ +(define (apply-quick-tint drawable tint-type) + (cond + ((= tint-type 0) ; Ciepły (sepia) + (gimp-drawable-color-balance drawable 0 TRUE 0.15 0.0 -0.1)) + + ((= tint-type 1) ; Chłodny (niebieski) + (gimp-drawable-color-balance drawable 0 TRUE -0.1 0.0 0.15)) + + ((= tint-type 2) ; Zielony (retro) + (gimp-drawable-color-balance drawable 0 TRUE 0.0 0.15 -0.05)) + + ((= tint-type 3) ; Magenta (dramatyczny) + (gimp-drawable-color-balance drawable 0 TRUE 0.1 -0.15 0.05)) + ) +) + +(define (create-highlights-curve adjustment) + (let ((curve-data (make-vector 256 'byte))) + (do ((i 0 (+ i 1))) + ((= i 256)) + (if (> i 128) + ; Światła - zastosuj regulację + (aset curve-data i (min 255 (max 0 (+ i (* (- i 128) adjustment))))) + ; Cienie - bez zmian + (aset curve-data i i) + ) + ) + curve-data + ) +) + +(define (create-shadows-curve adjustment) + (let ((curve-data (make-vector 256 'byte))) + (do ((i 0 (+ i 1))) + ((= i 256)) + (if (< i 128) + ; Cienie - zastosuj regulację + (aset curve-data i (min 255 (max 0 (+ i (* i adjustment))))) + ; Światła - bez zmian + (aset curve-data i i) + ) + ) + curve-data + ) +) + +(define (przem-oldschool-monochrome-photogrphy image drawable temperature strength tint-use + tint-type contrast highlights shadows whites blacks) + + (let* ( + (temperature-factor (/ (- temperature 6500) 1000)) + (red-adjust (* temperature-factor (- strength))) + (blue-adjust (* temperature-factor strength)) + (contrast-value (/ contrast 100)) + (adjust-value (/ highlights 100)) + (adjust-value-shadow (/ shadows 100)) + (whites-value (/ whites 100)) + (blacks-value (/ blacks 100)) + ) + (gimp-image-undo-group-start image) + (gimp-context-push) + + ; Balans kolorów z kontrolą siły efektu + (gimp-drawable-color-balance drawable 0 TRUE red-adjust 0 blue-adjust) + + (if (= tint-use TRUE) + (apply-quick-tint drawable tint-type)) + + (gimp-drawable-brightness-contrast drawable 0 contrast-value) + + ; Regulacja świateł przez krzywe + (gimp-drawable-curves-explicit drawable 0 256 (create-highlights-curve adjust-value)) + + ; Regulacja cieni przez krzywe + (gimp-drawable-curves-explicit drawable 0 256 (create-shadows-curve adjust-value-shadow)) + + ; Regulacja przez poziomy + ; low imput - high input - gamma - output range + (gimp-drawable-levels drawable 0 + blacks + whites + 1.0 0 255 0 0) + + + (gimp-image-undo-group-end image) + (gimp-displays-flush) + (gimp-context-pop) + ) +) + +(script-fu-register "przem-oldschool-monochrome-photogrphy" + _"Oldchool monochrome photography" + _"Fotografia ze starej szkoły" + "PRP" + "Public Domain" + "2025-09-25" + "RGB*" + SF-IMAGE "Image" 0 + SF-DRAWABLE "Drawable" 0 + SF-ADJUSTMENT "Temperatura (K)" '(5150 1000 10000 100 1000 0 1) + SF-ADJUSTMENT "Siła efektu" '(1.0 0.1 3.0 0.1 0.5 1 0) + SF-TOGGLE "Tint use" FALSE + SF-OPTION "Typ Tint" '("Ciepły" "Chłodny" "Zielony" "Magenta") + SF-ADJUSTMENT "Kontrast" '(-30 -100 100 1 10 0 0) + SF-ADJUSTMENT "Światła" '(-80 -100 100 1 10 0 0) + SF-ADJUSTMENT "Shadow" '(30 -100 100 1 10 0 0) + SF-ADJUSTMENT "Whites" '(0.1 -1.0 1.0 0.1 0.01 0.1 3) + SF-ADJUSTMENT "Blacks" ''(-0.35 -1.0 1.0 0.1 0.01 0.1 3) +) + +(script-fu-menu-register "przem-oldschool-monochrome-photogrphy" + "/Filters/PIETRASZCZYK/") diff --git a/script-fu/2.10/przem-true-cyjanotype.scm b/script-fu/2.10/przem-true-cyjanotype.scm new file mode 100644 index 0000000..1eb0835 --- /dev/null +++ b/script-fu/2.10/przem-true-cyjanotype.scm @@ -0,0 +1,99 @@ +; przem-true-cyjantype - imituje efekt prawdziwej cyjanotypii +; author: PRP +; licencja: Public Domain +; Gdańsk - 21-09-2025 +; ver. 2.250922-1 + +(define (przem-true-cyjantype image drawable r g b normalize value-blue invert replace) + (let* ((gradient-layer (car (gimp-layer-new image (car (gimp-image-width image)) (car (gimp-image-height image)) RGBA-IMAGE "Prussian Blue" 50 NORMAL-MODE))) + (is-nocolorful (car (gimp-drawable-is-gray drawable)))) + + (gimp-image-undo-group-start image) + (gimp-context-push) + + ; jeśli obraz jest szary to konwertuje go na RGB - tak na sztukę + (if (= is-nocolorful TRUE) + (gimp-image-convert-rgb image)) + + (gimp-image-insert-layer image gradient-layer 0 -1) + + (let* ( + ; oczekujemy procentów (np. 40, 40, 20) + (sum (+ r g b)) + (r1 (if (and normalize (> sum 0)) (/ r sum) (/ r 100.0))) + (g1 (if (and normalize (> sum 0)) (/ g sum) (/ g 100.0))) + (b1 (if (and normalize (> sum 0)) (/ b sum) (/ b 100.0))) + ) + (plug-in-colors-channel-mixer + RUN-NONINTERACTIVE + image drawable + TRUE + r1 g1 b1 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + ) + ) + (gimp-curves-spline + drawable + 0 + 6 + #(0 0 + 32 40 + 128 140 + 220 230 + 255 255) + ) + (gimp-layer-set-mode gradient-layer LAYER-MODE-OVERLAY) ; Tryb mieszania: Overlay + ; hue-range: 0 = Master, 1 = Reds, 2 = Yellows, 3 = Greens, 4 = Cyans, 5 = Blues, 6 = Magentas + ; hue-offset: -180..180 (stopnie), lightness: -100..100, saturation: -100..100 + ;(gimp-hue-saturation gradient-layer 0 160 0 30) ; Niebieski odcień + ;; --- 2. Koloryzacja --- + ;; hue: 0–360 (odcień), sat: -100..100, light: -100..100 + ;(gimp-colorize drawable 160 0 30) + (gimp-context-set-foreground '(0 51 102)) ; Kolor błękitu pruskiego + (gimp-context-set-background '(0 0 0)) + ;(gimp-layer-set-mode gradient-layer OVERLAY-MODE) + (gimp-edit-blend gradient-layer FG-BG-RGB-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE FALSE 0 0 TRUE 0 0 0 0) + (gimp-layer-set-opacity gradient-layer value-blue) + + (if (= invert TRUE) + (gimp-invert drawable)) + + (if (= replace TRUE) + ; Wybierz tylko czarne piksele + (gimp-image-select-color image CHANNEL-OP-REPLACE drawable '(0 0 0)) + + ; Wypełnij wybrane obszary kolorem granatowym + (gimp-context-set-foreground '(0 0 128)) ; RGB dla granatowego + (gimp-edit-bucket-fill drawable BUCKET-FILL-FG LAYER-MODE-NORMAL 100 0 FALSE 0 0) + ; Odznacz selekcję + (gimp-selection-none image)) + + (gimp-image-undo-group-end image) + (gimp-displays-flush) + (gimp-context-pop) + ) +) + +(script-fu-register "przem-true-cyjantype" + _"Apply true cyjanotype effect" + _"Pseudo-prawdziwa próba imitacji cyjanotypii" + "PRP" + "Public Domain" + "2025-09-21" + "RGB*, GRAY*" + SF-IMAGE "Image" 0 + SF-DRAWABLE "Drawable" 0 + SF-ADJUSTMENT "Participation R (%)" '(40 -200 200 1 10 0 1) + SF-ADJUSTMENT "Participation G (%)" '(40 -200 200 1 10 0 1) + SF-ADJUSTMENT "Participation B (%)" '(20 -200 200 1 10 0 1) + SF-TOGGLE "Normalize to 100%" TRUE + SF-ADJUSTMENT "Blue intensity" '(50 0 100 1 10 0 0) + SF-TOGGLE "Invert colors" FALSE + SF-TOGGLE "Replace black" FALSE + + +) + +(script-fu-menu-register "przem-true-cyjantype" + "/Filters/PIETRASZCZYK/") diff --git a/script-fu/3.0/przem-oldschool-photogrphy-v3.scm b/script-fu/3.0/przem-oldschool-photogrphy-v3.scm new file mode 100644 index 0000000..1f29d70 --- /dev/null +++ b/script-fu/3.0/przem-oldschool-photogrphy-v3.scm @@ -0,0 +1,156 @@ +; przem-oldschool-photogrphy-v3.sh - Fotografia ze starej szkoły +; 2025-09-25 - Przemysław R. Pietraszczyk +; licence: Public Domain +; ver. 2.250925-2 + +(define (shadows val) + (/ (* 0.96 val) 2.55)) + +(define (midtones val) + (/ val 2.55)) + +(define (highlights val) + ; The result is used as "gimp-drawable-color-balance" color parameter + ; and thus must be restricted to -100.0 <= highlights <= 100.0. + (min (/ (* 1.108 val) 2.55) 100.0)) + +(define (rval col) + (car col)) + +(define (gval col) + (cadr col)) + +(define (bval col) + (caddr col)) + + + +(define (apply-quick-tint img drawable width height saturation lightness hc) + + (gimp-drawable-color-balance drawable TRANSFER-SHADOWS 1 + (shadows (rval hc)) + (shadows (gval hc)) + (shadows (bval hc))) + (gimp-drawable-color-balance drawable TRANSFER-MIDTONES 1 + (midtones (rval hc)) + (midtones (gval hc)) + (midtones (bval hc))) + (gimp-drawable-color-balance drawable TRANSFER-HIGHLIGHTS 1 + (highlights (rval hc)) + (highlights (gval hc)) + (highlights (bval hc))) + + (gimp-drawable-hue-saturation drawable HUE-RANGE-ALL + 0.0 + lightness + saturation + 0.0)) + +(define (create-highlights-curve adjustment) + (let ((curve-data (make-vector 256 'byte))) + (do ((i 0 (+ i 1))) + ((= i 256)) + (if (> i 128) + ; Światła - zastosuj regulację + (aset curve-data i (min 255 (max 0 (+ i (* (- i 128) adjustment))))) + ; Cienie - bez zmian + (aset curve-data i i) + ) + ) + curve-data + ) +) + +(define (create-shadows-curve adjustment) + (let ((curve-data (make-vector 256 'byte))) + (do ((i 0 (+ i 1))) + ((= i 256)) + (if (< i 128) + ; Cienie - zastosuj regulację + (aset curve-data i (min 255 (max 0 (+ i (* i adjustment))))) + ; Światła - bez zmian + (aset curve-data i i) + ) + ) + curve-data + ) +) + +(define (przem-oldschool-photogrphy-v3 image drawable temperature strength tint-use + contrast highlights shadows whites blacks saturation lightness hc) + + ; use v3 binding of return args from PDB + ;(script-fu-use-v3) + + (let* ( + (temperature-factor (/ (- temperature 6500) 1000)) + (red-adjust (* temperature-factor (- strength))) + (blue-adjust (* temperature-factor strength)) + (contrast-value (/ contrast 100)) + (adjust-value-highlights (/ highlights 100)) + (adjust-value-shadow (/ shadows 100)) + (width (car (gimp-image-get-width image))) + (height (car (gimp-image-get-height image))) + (layer (vector-ref drawable 0)) + (work-layer (car (gimp-layer-copy layer TRUE))) + ) + (gimp-image-undo-group-start image) + (gimp-context-push) + + (gimp-image-insert-layer image work-layer 0 -1) + + (if (= tint-use TRUE) + (apply-quick-tint image work-layer width height saturation lightness hc)) + (if (= tint-use FALSE) + ; Balans kolorów na podstawie temp. barwowej z kontrolą siły efektu + (gimp-drawable-color-balance work-layer TRANSFER-SHADOWS 1 red-adjust 0 blue-adjust) + (gimp-drawable-color-balance work-layer TRANSFER-MIDTONES 1 red-adjust 0 blue-adjust) + (gimp-drawable-color-balance work-layer TRANSFER-HIGHLIGHTS 1 red-adjust 0 blue-adjust)) + + (gimp-drawable-brightness-contrast work-layer 0 contrast-value) + + ;(gimp-drawable-curves-spline work-layer HISTOGRAM-VALUE 10 #(0 0 64 90 128 160 192 230 255 255)) + ;(gimp-drawable-curves-spline work-layer HISTOGRAM-RED 10 #(0 0 64 50 128 180 192 230 255 255)) + ;(gimp-drawable-curves-spline work-layer HISTOGRAM-GREEN 10 #(0 0 64 80 128 120 192 200 255 255)) + ;(gimp-drawable-curves-spline work-layer HISTOGRAM-BLUE 10 #(0 0 64 30 128 150 192 220 255 255)) + ; lub + ;(define value #(0 0 64 90 128 160 192 230 255 255)) + ;(gimp-drawable-curves-spline work-layer HISTOGRAM-VALUE 10 value) + + ; Regulacja przez poziomy + ; low imput - high input - gamma - output range + (gimp-drawable-levels work-layer 0 + blacks + whites + 1.0 1.0 1.0 0 0) + + + (gimp-image-undo-group-end image) + (gimp-displays-flush) + (gimp-context-pop) + ) +) + +(script-fu-register-filter "przem-oldschool-photogrphy-v3" + _"Oldchool photography" + _"Fotografia ze starej szkoły" + "PRP" + "Public Domain" + "2025-09-25" + "RGB*" + SF-ONE-OR-MORE-DRAWABLE + SF-ADJUSTMENT "Temperatura (K)" '(5150 1000 10000 100 1000 0 1) + SF-ADJUSTMENT "Siła efektu" '(1.0 0.1 3.0 0.1 0.5 1 0) + SF-TOGGLE "Tint use" FALSE + SF-ADJUSTMENT _"Kontrast" '(-30 -100 100 1 10 0 0) + SF-ADJUSTMENT _"Światła" '(-80 -100 100 1 10 0 0) + SF-ADJUSTMENT _"Shadow" '(30 -100 100 1 10 0 0) + SF-ADJUSTMENT _"Whites" '(0 0 1 0.1 0.1 2 0) + SF-ADJUSTMENT _"Blacks" '(1 0 1 0.1 0.1 2 0) + SF-ADJUSTMENT _"Saturation" '(-80 -100 100 1 10 0 0) + SF-ADJUSTMENT _"Lightness" '(-47 -100 100 1 10 0 0) + SF-COLOR _"Highlight balance" '(211 95 0) +) + +(script-fu-menu-register "przem-oldschool-photogrphy-v3" + "/Filters/PIETRASZCZYK/") diff --git a/script-fu/changelog.md b/script-fu/changelog.md index 2465dcf..c38d33f 100644 --- a/script-fu/changelog.md +++ b/script-fu/changelog.md @@ -1,3 +1,15 @@ +# [2.250823-0] przem-burlesque-effect +* Nowy filtr imitujący burleske z winietowaniem + +# [2.250922-1] przem-true-cyjanotype.scm +* Próby podmiany czarnej barwy na navy - bez sukcesu + +# [2.250922-0] przem-true-cyjanotype.scm +* Revers kolorów, zbliżamy się do ideału + +# [2.250921-0] przem-true-cyjanotype.scm +* Nowy filtr, z nowym podejsćiem do cyjanotypii - bliższemu tradycyjnemu ideałowi + # [2.250901-0] przem-sunset-effect-v3.scm * Nowy filtr z imitacją zachodu słońca -- cgit v1.2.3