It is currently Thu Jun 27, 2024 1:16 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How do you run GIMP from the command line?
PostPosted: Thu Feb 10, 2022 1:10 pm  (#1) 
Offline
New Member

Joined: Feb 10, 2022
Posts: 1
I want to generate many images (100s) programmatically from a set of base images. This involves placing smaller pngs with transparent backgrounds on top of a larger image and exporting as a png. I would also like to be able to slightly stretch/darken/lighten the smaller pngs. I can easily do this in the GIMP GUI but I would really like to write a script that will do it automagically.

Looking at python-fu it seems like you can make additional gimp functions that you can use in the GUI but you cannot just write a script, run gimp headless and get the output with no user intervention.

I have been able to run simple gimp-fu commands through the command line, ex:
gimp -i -b '(simple-unsharp-mask "foo.png" 5.0 0.5 0)' -b '(gimp-quit 0)'
style commands but many of them result in a "Error: eval: unbound variable: batch-unsharp-mask" style error.

Is what I am attempting to do impossible? Where should I focus my effort, gimp-fu or python-fu? Is there another image-editing software/library that I should try that this would be possible for?

I have read a lot of tutorials but I am still stumped. Any help would be appreciated!


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 do you run GIMP from the command line?
PostPosted: Thu Feb 10, 2022 2:58 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Oct 23, 2021
Posts: 67
Hello cat_7433

Are you on Windows or Linux?
Because there are maybe some issues with double-quote vs. single quote or backslash in the command line.
Your function "batch-unsharp-mask" was not defined running Gimp from the command line.

Did "batch-unsharp-mask" work in the script-fu console?
Would you supply the source code of your batch-unsharp-mask?

I recommend to have two folders:
  • the source directory
  • the target directory
because you only need to delete the target directory to restart a new version of your unsharp-mask.
Do no process source and target files in the same folder.

If you are on Linux, just use file-glob to search files with joker such as *.png

On Windows, did you run Gimp in the PowerShell console or the Cmd console?

Have a look to GenCards? :coolthup
The source subfolder is "icon\*.jpg".
The target subfolder is "card".
Let me know if you are some questions about file-global or string-alter?

The following list of Gimp options could help:
--verbose --no-interface --no-data --no-splash --console-messages --stack-trace-mode=always --batch-interpreter "plug-in-script-fu-eval"


Top
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) G'MIC> Pattern> Strip command line?

2

No new posts GEGL command line and layer modes?

2

No new posts Calling GIMP Plug-in From Command Line - on Windows

0

No new posts Attachment(s) HELP - SEARCH AND RUN A COMMAND

6

No new posts Attachment(s) Inserting pdb.python_gegl command in my code

21



* Login  



Powered by phpBB3 © phpBB Group