Interacting with gimp in python3.
Use Cases:
- Autocompletion for writing gimp scripts.
- Batch creation or update of gimp files or data extraction from gimp files.
- Workflows where machine learning data has to be annotated. Raw data can be converted to gimp files where the annotation process can happen (gimp's thresholding tools etc. make it easy to do annotation for pixelwise segmentation). After the masks are created, they can be converted back to e.g. numpy files.
Read the documentation for details on what pgimp can do for you and how it is achieved. Every single public method comes with a short working example!
On setup, the GimpDocumentationGenerator
will generate python skeletons for the methods that gimp
exposes to the interpreter through the procedural database (pdb). This enables autocompletion in your IDE.
Running python code within gimp is performed by the GimpScriptRunner
. Have a look at the corresponding test
GimpScriptRunnerTest
to see how this works.
You may import convenience functions from pgimp.gimp
in your gimp python scripts.
See pgimp.GimpScriptRunnerTest.test_import_from_pgimp_library
.
The package manager pip
and the python packages setuptools
and psutil
are required in order
to install the package. As gimp uses a python2 interpreter,
the pip packages numpy
and typing
for python2 need to be installed.
On Linux, install the gimp package, e.g. sudo apt-get install gimp
for Debian/Ubuntu. In order to run headless,
install xfvb, e.g. sudo apt-get install xvfb
.
Newer Ubuntu versions come without python2 support for gimp. You can find a fix in the dockerfile for tests under
test/envs/linux/ubuntu/20.04/Dockerfile
.
Install gimp from gimp.org or via homebrew.
Windows is not supported.
pip3 install pgimp
Using a conda environment.yml file:
name: <NAME_OF_THE_ENV>
channels:
- defaults
dependencies:
- python=<3.6+>
- pip:
- pgimp
Using pip:
pip3 install git+https://github.com/mabu-github/pgimp
Using a conda environment.yml file:
name: <NAME_OF_THE_ENV>
channels:
- defaults
dependencies:
- python=<3.6+>
- pip:
- "git+https://github.com/mabu-github/pgimp"
Install using symlink to checked out code (for development):
pip3 install -e .
See CONTRIBUTING.md.
This project is licensed under the MIT license. See the LICENSE file for more info.