diff options
| author | Przemysław <przem@prymula.ct8.pl> | 2026-01-16 21:02:13 +0100 |
|---|---|---|
| committer | Przemysław <przem@prymula.ct8.pl> | 2026-01-16 21:02:13 +0100 |
| commit | 4254a9e8eceb7a10a6250dc329669af07d14adeb (patch) | |
| tree | bdce86c6ea36b82adbd5beb206d2b59f91833d2a /script-fu | |
| parent | 8a8eac8f5ae9ebb4f5ac9f85e408a986436ccbef (diff) | |
Diffstat (limited to 'script-fu')
| -rw-r--r-- | script-fu/3.0/przem-add-background-under-text-v3.scm | 27 | ||||
| -rw-r--r-- | script-fu/3.0/przem-apply-sepia-v3.scm | 30 | ||||
| -rw-r--r-- | script-fu/changelog.md | 5 |
3 files changed, 33 insertions, 29 deletions
diff --git a/script-fu/3.0/przem-add-background-under-text-v3.scm b/script-fu/3.0/przem-add-background-under-text-v3.scm index a6fffdf..7ea23da 100644 --- a/script-fu/3.0/przem-add-background-under-text-v3.scm +++ b/script-fu/3.0/przem-add-background-under-text-v3.scm @@ -2,15 +2,15 @@ ; author: PRP
; licencja: Public Domain
; Gdańsk - 06-02-2025
-; ver. 2.260116-0~alpha for Gimp 3.0
+; ver. 2.260116-1~beta for Gimp 3.0
(define (przem-add-background-under-text-v3 image drawable text font font-size fg-color bg-color background-transparency opacity)
(let* (
(type-layer (vector-ref drawable 0))
+ (type (car (gimp-drawable-type type-layer)))
(image-width (car (gimp-image-get-width image)))
(image-height (car (gimp-image-get-height image)))
- ;(text-extents (gimp-text-get-extents-fontname text font-size 0 font))
(text-extents (gimp-text-get-extents-font text font-size font))
(text-width (car text-extents))
(text-height (cadr text-extents))
@@ -18,21 +18,23 @@ (pos-y (- image-height text-height))
(bg-x-left (- pos-x 10))
(bg-x-right (+ text-width 10))
- ;(text-layer (car (gimp-text-fontname image -1 0 0 text 0 TRUE font-size 0 font)))
- (text-layer (car(gimp-text-font image -1 0 0 text 0 TRUE font-size font)))
- (bg-layer (car (gimp-layer-new image "Background" bg-x-right text-height RGB-IMAGE 100 LAYER-MODE-NORMAL)))
- (is-nocolorful (car (gimp-drawable-is-gray type-layer))) ; czy obraz jest w odcieniach szarości
+ (text-layer 0)
+ (bg-layer 0)
)
-
+
+ (gimp-context-push)
(gimp-image-undo-group-start image)
- ;(if (= is-nocolorful TRUE)
- ; (gimp-image-convert-rgb image)
- ;)
+ (if (> (car (gimp-drawable-type type-layer)) 1)
+ (gimp-image-convert-rgb image)
+ )
+
; Ustawienie koloru tła
(gimp-context-set-background bg-color)
(gimp-context-set-foreground fg-color)
+ (set! bg-layer (car (gimp-layer-new image "Background" bg-x-right text-height RGB-IMAGE 100 LAYER-MODE-NORMAL)))
+
(gimp-drawable-fill bg-layer FILL-BACKGROUND)
(gimp-layer-set-opacity bg-layer opacity)
@@ -49,6 +51,7 @@ (begin ; else
)
)
+ (set! text-layer (car(gimp-text-font image -1 0 0 text 0 TRUE font-size font)))
; Ustawienie pozycji tekstu
(gimp-layer-set-offsets text-layer pos-x pos-y)
@@ -59,10 +62,12 @@ ; Scalanie warstw
(gimp-image-merge-down image text-layer CLIP-TO-IMAGE)
+ (gimp-image-undo-group-end image) ; Zakończ grupę operacji undo
+
; Aktualizacja widoku
(gimp-displays-flush)
+ (gimp-context-pop)
- (gimp-image-undo-group-end image) ; Zakończ grupę operacji undo
)
)
diff --git a/script-fu/3.0/przem-apply-sepia-v3.scm b/script-fu/3.0/przem-apply-sepia-v3.scm index aa495b7..9ba52b4 100644 --- a/script-fu/3.0/przem-apply-sepia-v3.scm +++ b/script-fu/3.0/przem-apply-sepia-v3.scm @@ -2,7 +2,7 @@ ; author: PRP ; licencja: GPL v3 ; Gdańsk - 07-02-2025 -; ver. 2.2502022-0~beta for GIMP 3 +; ver. 2.260116-1~beta 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 @@ -29,25 +29,20 @@ (radius (sqrt (+ (* center-x center-x) (* center-y center-y)))) (the-layer 0) ) - + (gimp-context-push) (gimp-image-undo-group-start image) - ;(gimp-image-undo-disable image) + - ; TODO - z kodu old-photo wynika że nie trzeba konwertować na RGB - mimo tego kod nie dziala jak należy - ; jeśli obraz jest szary to konwertuje go na RGB - w RC2 ten numer nie przedzie - ;;(if (= type GRAY-IMAGE) - ; (gimp-image-convert-rgb image) ) - ; lub ... - ;(if (> (car (gimp-drawable-type (vector-ref drawable 0))) 1 ) - ; (gimp-image-convert-rgb image)) + (if (> (car (gimp-drawable-type layer)) 1) + (gimp-image-convert-rgb image) + ) + + (if (= type RGB-IMAGE) + (gimp-drawable-desaturate layer DESATURATE-LIGHTNESS) + ) (gimp-selection-all image) (set! the-layer (car (gimp-image-flatten image))) - - ; Konwersja obrazu do skali szarości - ;(if (= type RGB-IMAGE) - ;(gimp-drawable-desaturate the-layer DESATURATE-LIGHTNESS) - ;) (if (= in-sepia TRUE) (begin (gimp-drawable-desaturate the-layer DESATURATE-LIGHTNESS) @@ -114,9 +109,6 @@ 0 0) ) ) - - (gimp-context-pop) - ; Zmiana krycia warstwy (gimp-layer-set-opacity sepia-layer value-slider-sepia) @@ -130,6 +122,8 @@ ;(gimp-image-undo-enable image) (gimp-displays-flush) + (gimp-context-pop) + ) ) (script-fu-register-filter "przem-apply-sepia-v3" diff --git a/script-fu/changelog.md b/script-fu/changelog.md index 5604484..b62969c 100644 --- a/script-fu/changelog.md +++ b/script-fu/changelog.md @@ -1,3 +1,8 @@ +# [2.26016-1] przem-add-background-under-text-v3.scm przem-apply-sepia-v3.scm +* przem-add-background-under-text-v3 : Dodaje kolorowy napis zrówno na obrazach kolorowych jaki odcieniach szarości +* przem-apply-sepia-v3 : tworzy sepie zarówno z kolorowych jak i czarnobialych zdjęć +* przem-apply-sepia-v3 : widać szachownicę przeźroczystości - również po zapisie do jpg + # [2.260116-0] przem-add-background-under-text-v3.scm * Porządki, jednak filtr dalej nie dodaje kolorwego napisu do obrazów czarno-bialych |
