diff options
-rw-r--r-- | 2.10/przem-add-background-under-text.scm | 83 | ||||
-rw-r--r-- | 2.10/przem-apply-sepia.scm | 59 | ||||
-rw-r--r-- | 3.0/przem-add-background-under-text-v3.scm | 86 | ||||
-rw-r--r-- | 3.0/przem-apply-sepia-v3.scm | 104 | ||||
-rw-r--r-- | changelog.md | 14 |
5 files changed, 346 insertions, 0 deletions
diff --git a/2.10/przem-add-background-under-text.scm b/2.10/przem-add-background-under-text.scm new file mode 100644 index 0000000..9b9c977 --- /dev/null +++ b/2.10/przem-add-background-under-text.scm @@ -0,0 +1,83 @@ +; przem-add-background-under-text - Script-fu dodający podpis z tłem
+; author: PRP
+; licencja: Public Domain
+; Gdańsk - 06-02-2025
+; ver. 1.250209-1
+
+(define (przem-add-background-under-text image drawable text font font-size color background-transparency opacity)
+
+ (gimp-image-undo-group-start image)
+
+ (let* (
+ (image-width (car (gimp-image-width image)))
+ (image-height (car (gimp-image-height image)))
+ (text-extents (gimp-text-get-extents-fontname text font-size 0 font))
+ (text-width (car text-extents))
+ (text-height (cadr text-extents))
+ (pos-x (- (- image-width text-width) 40))
+ (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)))
+ (bg-layer (car (gimp-layer-new image bg-x-right text-height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
+ (is-nocolorful (car (gimp-drawable-is-gray drawable))) ; czy obraz jest w odcieniach szarości
+ )
+
+ ; Ustawienie koloru tła
+ (gimp-context-set-background color)
+ (gimp-drawable-fill bg-layer BACKGROUND-FILL)
+ (gimp-layer-set-opacity bg-layer opacity)
+
+ ; jeśli obraz jest szary to konwertuje go na RGB - tak na sztukę
+ (if (= is-nocolorful TRUE)
+ (gimp-image-convert-rgb image)
+ )
+
+ ; Dodanie warstwy tła pod tekstem
+ (gimp-image-insert-layer image bg-layer 0 -1)
+ ;(gimp-image-add-layer image new-layer 0)
+ (gimp-layer-translate bg-layer bg-x-left pos-y)
+
+ (if (= background-transparency TRUE)
+ (begin
+ (gimp-drawable-fill bg-layer TRANSPARENT-FILL)
+ )
+ (begin ; else
+ )
+ )
+
+ ; Ustawienie pozycji tekstu
+ (gimp-layer-set-offsets text-layer pos-x pos-y)
+
+ ; Przesuń warstwę tekstową na górę stosu warstw
+ (gimp-image-raise-item-to-top image text-layer)
+
+ ; Scalanie warstw
+ (gimp-image-merge-down image text-layer CLIP-TO-IMAGE)
+
+ ; Aktualizacja widoku
+ (gimp-displays-flush)
+
+ (gimp-image-undo-group-end image) ; Zakończ grupę operacji undo
+ )
+)
+
+(script-fu-register "przem-add-background-under-text"
+ _"Add Background Under Text"
+ _"Dodaje kolorowe tło pod tekstem z możliwością wyboru czcionki i rozmiaru."
+ "Przemysław R. Pietraszczyk"
+ "Public Domain"
+ "2025-02-06"
+ "RGB* GRAY*"
+ SF-IMAGE "Image" 0
+ SF-DRAWABLE "Drawable" 0
+ SF-STRING "Text" "Doda Elektroda"
+ SF-FONT "Font" "Sans-serif"
+ SF-ADJUSTMENT "Font Size" '(50 1 1000 1 10 0 1)
+ SF-COLOR "Background Color" '(255 215 0)
+ SF-TOGGLE "Background Transparency" FALSE
+ SF-ADJUSTMENT "Transparency Value" '(100 1 100 1 10 0 1)
+)
+
+(script-fu-menu-register "przem-add-background-under-text"
+ "<Image>/Filters/PIETRASZCZYK/")
diff --git a/2.10/przem-apply-sepia.scm b/2.10/przem-apply-sepia.scm new file mode 100644 index 0000000..91e43a3 --- /dev/null +++ b/2.10/przem-apply-sepia.scm @@ -0,0 +1,59 @@ +; przem-apply-sepia - Script-fu dodający prawdziwą sepie do zdjęcia +; author: PRP +; licencja: Public Domain +; Gdańsk - 07-02-2025 +; ver. 1.250208-0 + +(define (przem-apply-sepia image drawable value-slider-sepia) + + (let* ( + (image-width (car (gimp-image-width image))) + (image-height (car (gimp-image-height image))) + (center-x (/ image-width 2)) + (center-y (* image-height 0.5)) ; either is OK + (sepia-layer (car (gimp-layer-new image image-width image-height RGBA-IMAGE "Sepia Layer" 100 NORMAL-MODE))) + (is-nocolorful (car (gimp-drawable-is-gray drawable))) ; czy obraz jest w odcieniach szarości + ) + + (gimp-image-undo-group-start image) + + ; jeśli obraz jest szary to konwertuje go na RGB - tak na sztukę + (if (= is-nocolorful TRUE) + (gimp-image-convert-rgb image) + ) + + ; Konwersja obrazu do skali szarości + (gimp-desaturate drawable) + + ; Dodanie koloru sepii + (gimp-context-set-foreground '(112 66 20)) ; Kolor sepii + + (gimp-image-insert-layer image sepia-layer 0 -1) + + (gimp-selection-all image) + (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) + + ; Zmiana krycia warstwy + (gimp-layer-set-opacity sepia-layer value-slider-sepia) + + (gimp-image-merge-down image sepia-layer CLIP-TO-IMAGE) + + (gimp-image-undo-group-end image) + + (gimp-displays-flush) +) ) + +(script-fu-register "przem-apply-sepia" + _"Apply a sepia effect to the image" + _"Tworzy obraz sepii" + "Przemyslaw R. Pietraszczyk" + "Public Domain" + "2025-02-07" + "RGB* GRAY*" + SF-IMAGE "Image" 0 + SF-DRAWABLE "Drawable" 0 + SF-ADJUSTMENT "Sepia intensity" '(50 0 100 1 10 0 0) +) + +(script-fu-menu-register "przem-apply-sepia" + "<Image>/Filters/PIETRASZCZYK/") diff --git a/3.0/przem-add-background-under-text-v3.scm b/3.0/przem-add-background-under-text-v3.scm new file mode 100644 index 0000000..212a665 --- /dev/null +++ b/3.0/przem-add-background-under-text-v3.scm @@ -0,0 +1,86 @@ +; przem-add-background-under-text-v3 - Script-fu dodający podpis z tłem
+; author: PRP
+; licencja: Public Domain
+; Gdańsk - 06-02-2025
+; ver. 1.250210-0~alpha for Gimp 3.0
+
+(define (przem-add-background-under-text-v3 image drawable text font font-size color background-transparency opacity)
+
+ (gimp-image-undo-group-start image)
+
+ (let* (
+ (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))
+ (pos-x (- (- image-width text-width) 40))
+ (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 bg-x-right text-height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL)))
+ (is-nocolorful (car (gimp-drawable-is-gray drawable))) ; czy obraz jest w odcieniach szarości
+ )
+
+ ; Ustawienie koloru tła
+ (gimp-context-set-background color)
+ (gimp-drawable-fill bg-layer FILL-BACKGROUND)
+ (gimp-layer-set-opacity bg-layer opacity)
+
+ ; jeśli obraz jest szary to konwertuje go na RGB - tak na sztukę
+ (if (= is-nocolorful TRUE)
+ (gimp-image-convert-rgb image)
+ )
+
+ ; Dodanie warstwy tła pod tekstem
+ (gimp-image-insert-layer image bg-layer 0 -1)
+
+ ;(gimp-layer-translate bg-layer bg-x-left pos-y)
+ (gimp-selection-translate image bg-layer bg-x-left pos-y)
+
+ (if (= background-transparency TRUE)
+ (begin
+ (gimp-drawable-fill bg-layer FILL-TRANSPARENT)
+ )
+ (begin ; else
+ )
+ )
+
+ ; Ustawienie pozycji tekstu
+ (gimp-layer-set-offsets text-layer pos-x pos-y)
+
+ ; Przesuń warstwę tekstową na górę stosu warstw
+ (gimp-image-raise-item-to-top image text-layer)
+
+ ; Scalanie warstw
+ (gimp-image-merge-down image text-layer CLIP-TO-IMAGE)
+
+ ; Aktualizacja widoku
+ (gimp-displays-flush)
+
+ (gimp-image-undo-group-end image) ; Zakończ grupę operacji undo
+ )
+)
+
+(script-fu-register "przem-add-background-under-text-v3"
+ _"Add Background Under Text"
+ _"Dodaje kolorowe tło pod tekstem z możliwością wyboru czcionki i rozmiaru."
+ "Przemysław R. Pietraszczyk"
+ "Public Domain"
+ "2025-02-06"
+ "RGB* GRAY*"
+ SF-IMAGE "Image" 0
+ SF-DRAWABLE "Drawable" 0
+ SF-STRING "Text" "Doda Elektroda"
+ SF-FONT "Font" "Sans-serif"
+ SF-ADJUSTMENT "Font Size" '(50 1 1000 1 10 0 1)
+ SF-COLOR "Background Color" '(255 215 0)
+ SF-TOGGLE "Background Transparency" FALSE
+ SF-ADJUSTMENT "Transparency Value" '(100 1 100 1 10 0 1)
+)
+
+(script-fu-menu-register "przem-add-background-under-text-v3"
+ "<Image>/Filters/PIETRASZCZYK/")
diff --git a/3.0/przem-apply-sepia-v3.scm b/3.0/przem-apply-sepia-v3.scm new file mode 100644 index 0000000..494bae9 --- /dev/null +++ b/3.0/przem-apply-sepia-v3.scm @@ -0,0 +1,104 @@ +; przem-apply-sepia-v3 - Script-fu dodający prawdziwą sepie do zdjęcia +; author: PRP +; licencja: Public Domain +; Gdańsk - 07-02-2025 +; ver. 1.2502010-4 for GIMP 3 + +(define (przem-apply-sepia-v3 image drawable value-slider-sepia gradient-reverse gradient-shape) + + (let* ( + (image-width (car (gimp-image-get-width image))) + (image-height (car (gimp-image-get-height image))) + (center-x (/ image-width 2)) + (center-y (* image-height 0.5)) ; either is OK + (sepia-layer (car (gimp-layer-new image image-width image-height RGBA-IMAGE "Sepia Layer" 100 LAYER-MODE-NORMAL))) + (is-nocolorful (car (gimp-drawable-is-gray drawable))) ; czy obraz jest w odcieniach szarości + ) + + (gimp-image-undo-group-start image) + ;(gimp-image-undo-disable image) + + + + ; jeśli obraz jest szary to konwertuje go na RGB - tak na sztukę + (if (= is-nocolorful TRUE) + (gimp-image-convert-rgb image) + ) + + ; Konwersja obrazu do skali szarości + ;(gimp-desaturate drawable) + (gimp-drawable-desaturate drawable DESATURATE-LIGHTNESS) + + ; Dodanie koloru sepii + ;(gimp-context-set-foreground '(112 66 20)) ; Kolor sepii + + (gimp-image-insert-layer image sepia-layer 0 -1) + + + (gimp-context-push) + (gimp-context-set-foreground (list 112 66 20)) ; ciemniejsza + (gimp-context-set-background (list 210 180 140)) ; jasniejsza + ;(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-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 + GRADIENT-LINEAR 0 + 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 + GRADIENT-SHAPEBURST-DIMPLED 0 + FALSE 1 0 + TRUE + 0 0 image-width image-height) + ) ) + + (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) + + (gimp-image-undo-group-end image) + ;(gimp-image-undo-enable image) + + (gimp-displays-flush) +) ) + +(script-fu-register "przem-apply-sepia-v3" + _"Apply a sepia effect to the image" + _"Tworzy obraz sepii" + "Przemyslaw R. Pietraszczyk" + "Public Domain" + "2025-02-07" + "RGB* GRAY*" + SF-IMAGE "Image" 0 + SF-DRAWABLE "Drawable" 0 + SF-ADJUSTMENT "Sepia intensity" '(50 0 100 1 10 0 0) ; Suwak poziomy + SF-TOGGLE "Gradient reverse" FALSE + SF-TOGGLE "Shape" TRUE + + +) + +(script-fu-menu-register "przem-apply-sepia-v3" + "<Image>/Filters/PIETRASZCZYK/") diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..8559808 --- /dev/null +++ b/changelog.md @@ -0,0 +1,14 @@ +# [1.250910-0~alpha]
+* Wersja alpha 'przem-add-background-under-text.scm', pokazuje samo tło i w dodatku w złym miejscu
+
+# [1.250910-2]
+* Wersja stabilna 'przem-apply-sepia.scm' dla 3.0
+
+# [1.250209-1]
+* Wersja stabilna 'przem-add-background-under-text.scm' dla 2.10
+
+# [0.250207-0]
+* Incjacja skryptu 'przem-apply-sepia.scm'
+
+# [0.250206-0]
+* Incjacja skryptu 'przem-add-background-under-text.scm'
|