It is currently Thu Jul 04, 2024 3:57 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: script to load text file and create text layer
PostPosted: Thu Mar 18, 2021 4:04 pm  (#1) 
Offline
New Member

Joined: Mar 18, 2021
Posts: 3
I wrote this script and when I click on the font button I get the error dialog.

(define (script-fu-text-box inText inFont inFontSize inTextColor))


(script-fu-register
    "script-fu-text-box"                        ;func name
    "Load Text"                                 ;menu label
    "Loads the corresponding text file."        ;description
    "me"                              ;author
    "copyright 2021, me"              ;copyright notice
    "March 16, 2021"                            ;date created
    ""                     ;image type that the script works on
    SF-STRING      "Text"          "Text Box"   ;a string variable
    SF-FONT        "Font"          "Charter"    ;a font variable
    SF-ADJUSTMENT  "Font size"     '(50 1 1000 1 10 0 1)
                                                ;a spin-button
    SF-COLOR       "Color"         '(0 0 0)     ;color variable
  )
  (script-fu-menu-register "script-fu-text-box" "<Image>/File/Create/Text")



Image


I have a bunch of jpg picture files that have corresponding text files (same name but .txt instead of .jpg).
I want the script to load the text of the corresponding text file.
I'm hoping I can get the full path of the loaded jpg and replace .jpg with .txt and then load the text and create a text layer.
I have hundreds of images with corresponding text files so I'm hoping I can run this from the command line.
If someone wants give me a head start then that would be great. :-)


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: script to load text file and create text layer
PostPosted: Fri Mar 19, 2021 1:08 am  (#2) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
It's been a long time since I work in scheming. I think you should learn python, is much easier that scheme. You should start here:
www.youtube.com Video from : www.youtube.com

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: script to load text file and create text layer
PostPosted: Fri Mar 19, 2021 7:28 pm  (#3) 
Offline
New Member

Joined: Mar 18, 2021
Posts: 3
thanks.


Top
 Post subject: Re: script to load text file and create text layer
PostPosted: Sat Mar 20, 2021 5:38 am  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
bjlockie wrote:
I wrote this script and when I click on the font button I get the error dialog.

(define (script-fu-text-box inText inFont inFontSize inTextColor))


(script-fu-register
    "script-fu-text-box"                        ;func name
    "Load Text"                                 ;menu label
    "Loads the corresponding text file."        ;description
    "me"                              ;author
    "copyright 2021, me"              ;copyright notice
    "March 16, 2021"                            ;date created
    ""                     ;image type that the script works on
    SF-STRING      "Text"          "Text Box"   ;a string variable
    SF-FONT        "Font"          "Charter"    ;a font variable
    SF-ADJUSTMENT  "Font size"     '(50 1 1000 1 10 0 1)
                                                ;a spin-button
    SF-COLOR       "Color"         '(0 0 0)     ;color variable
  )
  (script-fu-menu-register "script-fu-text-box" "<Image>/File/Create/Text")



[ Image ]


I have a bunch of jpg picture files that have corresponding text files (same name but .txt instead of .jpg).
I want the script to load the text of the corresponding text file.
I'm hoping I can get the full path of the loaded jpg and replace .jpg with .txt and then load the text and create a text layer.
I have hundreds of images with corresponding text files so I'm hoping I can run this from the command line.
If someone wants give me a head start then that would be great. :-)


This would be a lot easier with ImageMagick and a shell script: https://legacy.imagemagick.org/Usage/annotating/

If you stick to Gimp, for a batch your don't need to register the script: https://stackoverflow.com/questions/444 ... 0#44435560

_________________
Image


Top
 Post subject: Re: script to load text file and create text layer
PostPosted: Thu Apr 15, 2021 6:53 pm  (#5) 
Offline
New Member

Joined: Mar 18, 2021
Posts: 3
The problem with ImageMagick is that won't save the text as a layer.
I may use that though.


Top
 Post subject: Re: script to load text file and create text layer
PostPosted: Thu Apr 15, 2021 10:26 pm  (#6) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Where did you place the script? The script have to be install in: C:\Users\YourName\AppData\Roaming\GIMP\2.10\scripts

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: script to load text file and create text layer
PostPosted: Fri Apr 16, 2021 6:14 am  (#7) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
@bjlockie

The error you are seeing was a bug in GIMP: https://gitlab.gnome.org/GNOME/gimp/-/issues/4641 which was fixed at GIMP 2.10.20 so I thing you need to update your version of GIMP to the latest: 2.10.24


Top
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Cannot edit text in a layer from a PSD file

1

No new posts Attachment(s) manipulate a portion of text inside a text layer using python-fu

2

No new posts Attachment(s) create a web and spiderman text plugin

2

No new posts Attachment(s) Create a retro Op Art Text plugin

0

No new posts Attachment(s) Create an Underwater Text plugin

9



* Login  



Powered by phpBB3 © phpBB Group