GIMP Chat
http://gimpchat.com/

How to pass textvariable to GMIC from python [solved]
http://gimpchat.com/viewtopic.php?f=28&t=19760
Page 1 of 1

Author:  nelo [ Thu Dec 30, 2021 5:20 am ]
Post subject:  How to pass textvariable to GMIC from python [solved]

Hi all,

In a python script for GIMP 2.10 I try to implement the possibility to add a GMIC watermark.
This would be the line to use:
pdb.plug_in_gmic_qt(image,layer,1,1,"fx_watermark_visible watermarktext,0.1568,50,25,0.5,1")

How do I pass "watermarktext" as a variable to this GMIC call?

Author:  gasMask [ Thu Dec 30, 2021 6:36 am ]
Post subject:  Re: How to pass textvariable to GMIC from python

Hi nelo,
I'm don't know the syntax for GMIC calls, but shouldn't there be a comma between the parameters?
pdb.plug_in_gmic_qt(image,layer,1,1,"fx_watermark_visible,watermarktext,0.1568,50,25,0.5,1")

Author:  rich2005 [ Thu Dec 30, 2021 8:42 am ]
Post subject:  Re: How to pass textvariable to GMIC from python

It should go like this:

pdb.plug_in_gmic_qt (image, drawable, 1, 0,   'fx_watermark_visible "Nelos Files",0.4,50,25,0.5,1')


Note the nested quotes ' ' around the " "

Attached my testing script. Find it in the tools menu - run gmic

Attachments:
for_gmic.zip [476 Bytes]
Downloaded 42 times

Author:  nelo [ Thu Dec 30, 2021 9:37 am ]
Post subject:  Re: How to pass textvariable to GMIC from python

Thanks Rich,
That's what I already had and it only took the "hardcoded" text.
But I wanted it to be a variable, so the user can input what watermarktext they want.
Sorry if it wasn't clear enough.

Ok long story short.
I finally found this solution:
pdb.plug_in_gmic_qt(image,layer,1,0,"fx_watermark_visible {0},0.1568,50,25,0.5,1".format(watermarktext))

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/