gimpfu

Gimp Python plugin gimp.Image as numpy array

佐手、 提交于 2019-12-07 16:51:51
问题 I'm working on a python plugin for GIMP and I would like to obtain the RGB matrix of a layer as a numpy array. To access the layer in the python plugin I use the next code: def python_function(img, layer): layer = img.layers[0] I would like to make layer variable, instead of a gimp.Image variable, a numpy array containing, for each pixel, its RGB values. What I use in other nonGimp-python code is this next line: frame2 = misc.imread('C:\Users\User\Desktop\image2.png').astype(np.float32) . If

Writing a GIMP python script

我们两清 提交于 2019-12-03 06:10:02
问题 What I want to do is to open gimp from a python program (with subprocess.Popen, perhaps), and in the same time, gimp will start with a python script that will open an image and add a layer... Well, how can I achieve that(I wish GIMP had better documentation...)? Update: I did this: subprocess.Popen(["gimp", "--batch-interpreter" , "python-fu-eval" , "-b" ,"\'import sys; sys.path.append(\"/home/antoni4040\"); import gimpp; from gimpfu import *; gimpp.main()\'"]) ,but, even if the console says

Writing gimp plugins in python on windows- how do i debug? where is the output?

萝らか妹 提交于 2019-12-02 20:33:39
EDITED HEAVILY with some new information (and a bounty) I am trying to create a plug in in python for gimp. (on windows) this page http://gimpbook.com/scripting/notes.html suggests running it from the shell, or looking at ~/.xsession-errors neither work. I am able to run it from the cmd shell, as gimp-2.8.exe -c --verbose ## (as suggested by http://gimpchat.com/viewtopic.php?f=9&t=751 ) this causes the output from "pdb.gimp_message(...)" to go to a terminal. BUT !!! this only works when everything is running as expected , i get no output on crashes. i've tried print statements, they go nowhere

How to run python scripts using gimpfu from windows command line?

扶醉桌前 提交于 2019-11-27 02:13:28
I'm trying to use functions of gimp 2.8.22 to convert a pdf to jpeg and i want to do that with a python script using the gimpfu library from my windows cmd (i have installed python 3.6.1). Right now, i't trying to do that with an example script: #!/usr/bin/env python # Hello World in GIMP Python from gimpfu import * def hello_world(initstr, font, size, color) : # First do a quick sanity check on the font if font == 'Comic Sans MS' : initstr = "Comic Sans? Are you sure?" # Make a new image. Size 10x10 for now -- we'll resize later. img = gimp.Image(1, 1, RGB) # Save the current foreground color

How to run python scripts using gimpfu from windows command line?

久未见 提交于 2019-11-26 07:49:35
问题 I\'m trying to use functions of gimp 2.8.22 to convert a pdf to jpeg and i want to do that with a python script using the gimpfu library from my windows cmd (i have installed python 3.6.1). Right now, i\'t trying to do that with an example script: #!/usr/bin/env python # Hello World in GIMP Python from gimpfu import * def hello_world(initstr, font, size, color) : # First do a quick sanity check on the font if font == \'Comic Sans MS\' : initstr = \"Comic Sans? Are you sure?\" # Make a new