From 63feeb9f369fc6176e85c1c2d8fcc863caad1946 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Tue, 10 Feb 2026 12:32:48 +0100 Subject: start new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- .local/share/GIMP/plug-ins/watermark.py | 84 --------------------------------- 1 file changed, 84 deletions(-) delete mode 100755 .local/share/GIMP/plug-ins/watermark.py (limited to '.local/share/GIMP/plug-ins/watermark.py') diff --git a/.local/share/GIMP/plug-ins/watermark.py b/.local/share/GIMP/plug-ins/watermark.py deleted file mode 100755 index 0f9f1f9..0000000 --- a/.local/share/GIMP/plug-ins/watermark.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/python - -from datetime import date -from gimpfu import * - -def watermarkfu(timg, tdrawable, - watermark, - anotherline="", - scalefactor_text=12.0, - scalefactor_boundry=2.3, - watermark_opacity=16.66): - - # make copy of input - img = pdb.gimp_image_duplicate(timg) - - # simplify source image - img.flatten() - - # expand text macro - anotherline = anotherline.replace("", - date.today().strftime("%Y-%m-%d")) - - # create text - text = pdb.gimp_text_layer_new(img, - "\n".join([watermark, anotherline]), - "Iosevka Ultra-Bold", - 68, UNIT_POINT) - - # add to image, justification doesn't work otherwise - img.add_layer(text, 0) - - # justify text - pdb.gimp_text_layer_set_justification(img.layers[0], TEXT_JUSTIFY_CENTER) - - # scale down text layer, maintaining ratio - pdb.gimp_layer_scale(img.layers[0], - ((float(text.width)/text.height)*(img.height/scalefactor_text)), - (img.height/scalefactor_text), - TRUE) - - # crate padding around text - pdb.gimp_layer_resize(img.layers[0], - (text.width*scalefactor_boundry), - (text.height*scalefactor_boundry), - (((text.width*scalefactor_boundry)-text.width)/2), - (((text.height*scalefactor_boundry)-text.height)/2), - ) - - pdb.plug_in_make_seamless(img, img.layers[0]) - pdb.plug_in_tile(img, img.layers[0], img.width, img.height, False) - - # move to 0,0 - (offx, offy) = pdb.gimp_drawable_offsets(img.layers[0]) - pdb.gimp_layer_translate(img.layers[0], (offx*-1), (offy*-1)) - - # tune mode + opacity - pdb.gimp_layer_set_opacity(img.layers[0], watermark_opacity) - pdb.gimp_layer_set_mode(img.layers[0], HARDLIGHT_MODE) - - # show to user - pdb.gimp_display_new(img) - - -register( - "python_fu_watermark", - "WatermarkFu", - "WatermarkFu", - "robertgzr", - "robertgzr", - "2023", - "/Filters/Render/WatermarkFu", - "RGB*, GRAY*", - [ - (PF_STRING, "watermark", "watermark text", ""), - (PF_STRING, "anotherline", "another line", ""), - (PF_FLOAT, "scalefactor_text", "scalefactor text", 12.0), - (PF_FLOAT, "scalefactor_boundry", "scalefactor boundry", 2.3), - (PF_FLOAT, "watermark_opacity", "watermark opacity", 16.66), - ], - [], - watermarkfu, -) - -main() -- cgit 1.4.1