GIMP Chat
http://gimpchat.com/

How do you run GIMP from the command line?
http://gimpchat.com/viewtopic.php?f=9&t=19821
Page 1 of 1

Author:  cat_7433 [ Thu Feb 10, 2022 1:10 pm ]
Post subject:  How do you run GIMP from the command line?

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!

Author:  AlSchemist [ Thu Feb 10, 2022 2:58 pm ]
Post subject:  Re: How do you run GIMP from the command line?

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"

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