diff options
| author | Robert Günzler <r@gnzler.io> | 2026-02-10 12:32:48 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2026-02-10 12:41:25 +0100 |
| commit | 63feeb9f369fc6176e85c1c2d8fcc863caad1946 (patch) | |
| tree | 41cd5d2d1ec36e74e464caab722cc9b460153f04 /.local/share/GIMP | |
| parent | 5bd0a4aca65ecb9818ef1285982d160b6b6ff665 (diff) | |
start new
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '.local/share/GIMP')
| -rwxr-xr-x | .local/share/GIMP/plug-ins/watermark.py | 84 |
1 files changed, 0 insertions, 84 deletions
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="<today>", - 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("<today>", - 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", - "<Image>/Filters/Render/WatermarkFu", - "RGB*, GRAY*", - [ - (PF_STRING, "watermark", "watermark text", ""), - (PF_STRING, "anotherline", "another line", "<today>"), - (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() |