[Gimp] Start scripting in Python

Let's create a very simple script.

Script creation location

Where to write the script Place it in the location displayed in "Edit"-"Settings"-"Folders"-"Plugins". The version is 2.8 gimp_config.png

script

It seems that you can do it by registering with Gimp. Set variously in the argument of register method. Please refer to the document etc. for details.

#coding: UTF-8
from gimpfu import *

def plugin_main(timg, tdrawable):
    pdb.gimp_message("TEST")

#Register with Gimp
register(
        "python_fu_resize",  #The name of the command when called from the command line or script
        "",  #Information about plugins displayed in the procedure browser
        "",  #Information about plugins displayed in the procedure browser
        "o-kuhiiro",  #Author's name
        "o-kuhiiro",  #Copyright holder's name
        "2015",  #Year of copyright
        "<Image>/test.py",  #Labels used for plugins in menus
        "RGB*, GRAY*",  #The type of image to be processed by the plugin
        [],  #argument
        [],  #Return value
        plugin_main  #Function name
)

main()

Run

Open the appropriate image in Gimp. Then in the menu gimp_py_run.PNG You will be able to execute it.

Also, you can start interactive mode with "Filter"-"Python-Fu"-"Console".

Recommended Posts

[Gimp] Start scripting in Python
Start in 5 minutes GIMP Python-Fu
Quadtree in Python --2
Python in optimization
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
SendKeys in Python
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Start using Python
Python quick start
Sudoku in Python
DCI in Python
quicksort in python
N-Gram in Python
[Python] Start studying
Programming in python
Plink in Python
Constant in python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
gnubg python scripting
Reflection in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
flatten in python
Sorted list in Python
Daily AtCoder # 36 in Python
Clustering text in Python
Daily AtCoder # 2 in Python
Implement Enigma in python
Daily AtCoder # 32 in Python
Daily AtCoder # 6 in Python
Daily AtCoder # 18 in Python
Edit fonts in Python
Singleton pattern in Python
File operations in Python
Read DXF in python
Daily AtCoder # 53 in Python