It is currently Tue Aug 18, 2026 9:57 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How to pass textvariable to GMIC from python [solved]
PostPosted: Thu Dec 30, 2021 5:20 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
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?

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Last edited by nelo on Thu Dec 30, 2021 9:37 am, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: How to pass textvariable to GMIC from python
PostPosted: Thu Dec 30, 2021 6:36 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2019
Posts: 282
Location: Lake Havasu City, Arizona, USA
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")

_________________
Charles


Top
 Post subject: Re: How to pass textvariable to GMIC from python
PostPosted: Thu Dec 30, 2021 8:42 am  (#3) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2613
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 68 times
Top
 Post subject: Re: How to pass textvariable to GMIC from python
PostPosted: Thu Dec 30, 2021 9:37 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
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))

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group