Questions tagged [gimpfu]

gimpfu is a python module similar to python-fu which provides an interface for writing plug-ins for gimp in python

For more information refer to the Gimp Python Documentation

121 questions
3
votes
1 answer

Gimp python-fu script to select everything with a given color and change it to a different color

I am writing a plugin script that will open a file, select by color, change the selection to a new color, save image as a new file. I don't know how to change the color to a new color. Can someone provide guidance? This is what I have so far: #…
Walter Moore
  • 77
  • 2
  • 9
3
votes
1 answer

GIMP Python Plugin to load 2 images as layers

I'm trying to make a plugin for gimp that opens two images as separate layers and transforms one of them (more on that below). I'm using GIMP 2.10.12. I've been struggling to find a proper complete documentation for GIMP's Python interface and am…
Mate de Vita
  • 1,102
  • 12
  • 32
3
votes
1 answer

How to execute a "Channel to Selection" in Gimp python-fu?

I want to convert custom channels into selection using python-fu. This can be done manually in Gimp using "Channel to Selection". I can retrieve the image and the channel as Python objects but I can’t figure out how to convert this channel to…
Narann
  • 819
  • 2
  • 8
  • 20
3
votes
1 answer

Gimp Python plugin gimp.Image as numpy array

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…
user2229358
3
votes
1 answer

GIMP python-fu call function plug_in_beautify 'wrong number of parameters'

I try to use the great Beautify plugin in python command line and I am unable to call the function the right way! Here is my code: import os from gimpfu import * inputPath = os.path.join('xxxx', 'fire.png') if(file.lower().endswith(('.png'))): …
jcs
  • 426
  • 3
  • 14
3
votes
1 answer

Close current file/view/display without saving it or beeing asked to do so

I have opened an xcf file "BY HAND" in Gimp. How can i close this file (that is also the current view/display) without beeing asked if i want to save it. I need the register function to give me the "current Display" something like PF_Display ...…
Andre Elrico
  • 10,956
  • 6
  • 50
  • 69
3
votes
1 answer

Gimp: How to export an image to BMP without the color space information using a python script?

I'm writing a python script for Gimp to export all the layers of an image to BMPs. To export a given layer, I use the procedure file_bmp_save: pdb.file_bmp_save(image, layer, filename, raw_filename) But this function save the color space…
user4780495
  • 2,642
  • 2
  • 18
  • 24
3
votes
2 answers

How do you call gimp_file_load?

>>> pdb.gimp_file_load.nparams 3 >>> pprint.pprint(pdb.gimp_file_load.params) ((0, 'run-mode', 'The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }'), (4, 'filename', 'The name of the file to load'), (4, 'raw-filename', 'The name as…
Thanatos
  • 42,585
  • 14
  • 91
  • 146
2
votes
4 answers

gimp python - how to change pixel color?

I would like to load 2 jpg images with Gimp Python. Then the pictures should be compared pixel by pixel. If the pixel in picture 2 has a certain rgb value, the pixel in picture 1 should be colored. Before that, a user input should be made in which…
Chris
  • 75
  • 1
  • 9
2
votes
1 answer

GIMP Python - Fill Path/Vector with color

I am trying to develop a script that i can run on opened SVG files. I want to iterate over all paths and fill the path with an arbitrary color ( I will be replacing this part of the code later). The first stage of this is just iterating over the…
bpilling
  • 183
  • 9
2
votes
0 answers

How can I run headless (batch) gimp on AWS Lambda function?

I have tried copying the executable and its dependencies but can't seem to perfect that. Do I have another option? I am using python3.
2
votes
1 answer

Gimp Python plugin loading image disables undo history

I have a set of images that I am trying to process manually, so I wrote a simple plug-in to try and help make it a little less painful. The images are numbered sequentially. So when I finish working on one image I can hit a key combo and it saves…
dcofer
  • 303
  • 2
  • 10
2
votes
3 answers

calling a gimp-fu function from an external module

I'm trying to write a sort of wrapper library for GIMP to make my generative art projects easier, but i'm having a problem interfacing with gimpfu from a my wrapper module. The following plugin code runs fine, and displays an image with horizontal…
Brendan
  • 73
  • 5
2
votes
2 answers

Open files with python script in Gimp like File->Open

TL;DR: How to open an Image in Gimp with Python like you do with (File->Open) in order to get the Overwrite file.png option and avoid the Save the changes to image 'sample.png' before closing? Dialog. I wrote a Python script for Gimp which does a…
2
votes
1 answer

GIMP python line drawing very slow

pdb.gimp_paintbrush_default seems to be very slow (several seconds, for 500 dots using a standard brush. Lines are worse, obviously). Is this the way it is? Is there a way to speed things up when drawing straight lines using the user selected…
mikro
  • 125
  • 7
1
2
3
8 9