Generates watermark by bump mapping the selected layer with the specified input text. Uses the bump mapping technique found here: http://www.gimp.org/tutorials/The_Basics/
I find that adding the two lines as follows you can undo the script with one click only.
Hope it helps,
#save the back and foreground colors
pdb.gimp_image_undo_group_start(image) <--- (added)
background = gimp.get_background()
foreground = gimp.get_foreground()
#reset to original back and foreground
pdb.gimp_image_undo_group_end(image) <--- (added)
I would just add that instead of saving/restoring the foreground and background colors, one can use gimp-context-push and gimp-context-pop (this will also restore pattern, gradient, palette, font, and brush settings to their original state).
This script is very nice. However I cannot change the font, it gives an error
"An error occured running python_fu_bumptext
AttributeError: 'NoneType' object has no attribute 'group' "
How to tackle this?
I made a small hack to the plug-in to enable it to use other fonts. Just make these changes:
Make your definitions like this:
def python_bumptext(image, drawable, text, fontname, fontsize, blur, depth, x, y, rotation, invert):
Comment out the following:
#split the font size from the name
#font = re.search("(.*) (\d+)", font)
#fontname = font.group(1)
#fontsize = font.group(2)
Add the following PF_FLOAT parameter (note its place in the list & leave out the <------):
(PF_STRING, "text", "Text to bump", "Bump Me"),
(PF_FONT, "font", "Choose Font", 'Arial'),
(PF_FLOAT, "size", "Size of Font", 36.0), <-------
(PF_INT, "blur", "Text blur", '5'),
(PF_INT, "depth", "Depth", '3'),
(PF_INT, "x", "Text X Placement", '0'),
(PF_INT, "y", "Text Y Placement", '0'),
(PF_SLIDER, "rotation", "Text Rotation", 0, [-180, 180, .5]),
(PF_TOGGLE, "invert", "Invert", 0)
That gives you the ability to adjust font size.
Just one small problem when making a Font selection, if you click the Font choice on the menu and decide to keep the original font, it will throw a layer error on the image, and not complete. Just undo the current process and start all over.
I understand the need to separate font size from font name (font widget string format), but I have no idea why font.group has no attributes, even tried to figure out how it would even work without them. I guess that's for the author to explain.
I fixed line 33 in the script. I don't know if it's because I was usying pygimp on windows, if the l changed to L pygimp side, or if it was just my typo. Enjoy.
No questions yet ...