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

2018-02-23 Thread Ofnuts
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

https://www.dropbox.com/s/hgg08yen5220wu9/gimpbatch.zip?dl=0

(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 myplugin.py.  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/



FILENAME="$1"
if [ ! -f "$FILENAME" ]; then
 echo File not found - you must pass the psd file to be converted
with gimp
 exit 1
fi
BASE="${FILENAME%.*}"
mkdir "$BASE"
DIR_OF_THIS_SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "(plug-in-path
\"\${gimp_dir}/plug-ins:\${gimp_plug_in_dir}/plug-ins:$DIR_OF_THIS_SCRIPT/gimpplugin\")"

gimprc

gimp -i -g gimprc -b "
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE \"$FILENAME\"
\"$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: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list



___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list


Re: [Gimp-developer] How to get color tag of layer in python plugin script?

2018-02-23 Thread Carol Spears
On Thu, Feb 22, 2018 at 11:06 PM, John Tapsell  wrote:

> On 23 Feb 2018 10:57, "Carol Spears"  wrote:
>
>
>
> On Thu, Feb 22, 2018 at 7:37 PM, John Tapsell  wrote:
>
>> Thanks! It would be cool if it was a property on the layer itself in
>> python, and if there was a version that returned the actual colour name
>> instead of a number. (there isn't, right?)
>>
>> /Filers/Python Fu/Console has a browser button that gives a
> searchable list of what can be done.  I suggest that you search for "tag".
>
> Thanks - I don't see anything other than the get and set function, so I
> think this confirms that there is no method for getting the color tag as a
> string.  This is something that needs to be converted manually I think.
>

I was pleased to find that the new Layers Dialog is not just a pretty
face

carol
___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list