How to use an external command to make an edit of pic in the gimp and then return the result to the stage in a plugin or script.
Example in shell script.:
magick label.gif matte
( clone -shade 110x90 -normalize -negate clone -compose Plus -composite )
( -clone 0 -shade 110x50 -normalize -channel BG -fx 0 channel -matte )
-delete 0 swap -compose Multiply -
The command above (imagemagick app) create a gif and i want put back in gimp stage. May be other simple option or application, but i need of return the edited back to gimp. Python, script fu? Thanks so much.
CodePudding user response:
If GIMP will take stdin, then pipe from ImageMagick to GIMP using the GIMP XCF file format.
magick label.gif matte
( clone -shade 110x90 -normalize -negate clone -compose Plus -composite )
( -clone 0 -shade 110x50 -normalize -channel BG -fx 0 channel -matte )
-delete 0 swap -compose Multiply XCF:- | GIMP -
CodePudding user response:
There is a shellout.py
Gimp plugin floating around from which you can borrow code. Typically:
- you export the layer to a temp file (if you work on the whole image, you likely have to do a
pdb.gimp_layer_new_from_visible()
) - call the executable with
subprocess.Popen()
and a list of arguments - load the result as a new layer with
pdb.gimp_file_load_layer()