Re: [Gimp-developer] Using gimp in a script

You don't  need to register the python code as  a plugin if you are only using it in this kind of script.

Link to a ZIP with a sample Python script and a sample shell

(written in Gimp 2.6 times but not much changes since)

On 02/23/18 07:12, John Tapsell wrote:
Can I improve this somehow?

I have a gimp plugin as  I want to run this from the command
line on given file(s).  I wrote this script which works, but I'm wondering
if I can improve it at all.   I have this script in a folder, and the
plugin in a subfolder  gimpplugin/

if [ ! -f "$FILENAME" ]; then
         echo File not found - you must pass the psd file to be converted
with gimp
         exit 1
mkdir "$BASE"
DIR_OF_THIS_SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "(plug-in-path
gimp -i -g gimprc -b "
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE \"$FILENAME\"
        (drawable (car (gimp-image-get-active-layer image))))
        (python-fu-myplugin RUN-NONINTERACTIVE image drawable)
        (gimp-image-delete image))"  -b '(gimp-quit 0)'

rm gimprc
echo $BASE done
gimp-developer-list mailing list
List address:    gimp-developer-list gnome org
List membership:
List archives:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]