Re: [Gimp-user] Copy text layers as text or python script to mass generate text layers



On 9/25/2017 10:20 AM, The Tick wrote:
This is gimp 2.8.22 on windows

I want to merge two images and both have quite a few text layers. I
found that an edit->copy does not copy a text layer -- it makes it an
image layer. I really do now want that since I will definitely have to
modify some of the text in the future as I continue expanding the image.

1) Am I missing something? Is there a way to copy a text layer between
images?
2) If not, perhaps I could write a very simple, one-time script to mass
create the text layers (I'd have to move them to the correct locations
but that is simpler than click-enter text-click and move for each of the
layers.

I found the reference to script-fu but I have never wrapped my head
around scheme/lisp and I don't want to start now. Where are the docs for
the python interface? I am assuming there is some interface to create a
text layer via scripting.

I found the docs for gimp python; now:

1) How to get "print" statments? I started filters->python fu->console but apparently a "print" does not write to the console?

2) How can I refresh the script? So far I restart gimp but that is getting tedious.

3) Is there an online site with hints on how to debug a gimp python script?

For reference, here is the script. It apparently runs but I get no new layer and no progress/console output. I did not expect it to work first time so now I'd like some pointers on how to debug it.


from gimpfu import *

def mass_text(img) :
    print "Does this go to console?"

    pdb.gimp.progress_init("Mass text insert ...")

    font = 'Arial Bold'

    pdb.gimp.set_foreground( 1.0, 0.0, 0.0 )

    # Create a new text layer (-1 for the layer means create a new layer)
    layer = pdb.gimp_text_fontname(img, None, 0, 0, "This is my text", 10,
                                   True, 24, PIXELS, font)
    img.add_layer(layer, 0)


register(
    "python_fu_mass_text",
    "Mass Text",
    "Mass create text layers",
    "",
    "",
    "",
    "Mass Text Layer insert...",
    "*",
    [
    ],
    [],
    mass_text, menu="<Image>/Tools/MassText")

main()







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]