Welcome, Guest |
You have to register before you can post on our site.
|
Latest Threads |
Is there any version wher...
Forum: Older Gimp versions (2.8, 2.6....)
Last Post: rich2005
2 hours ago
» Replies: 1
» Views: 205
|
How do I uninstall GIMP 3...
Forum: Linux and other Unixen
Last Post: Ofnuts
2 hours ago
» Replies: 1
» Views: 57
|
AI Gimp Plugins
Forum: Watercooler
Last Post: merlilderman
Yesterday, 04:16 PM
» Replies: 21
» Views: 68,183
|
How to make a watermark o...
Forum: General questions
Last Post: kyolim
09-13-2025, 10:05 PM
» Replies: 5
» Views: 14,170
|
Linux command that does e...
Forum: Other graphics software
Last Post: rich2005
09-13-2025, 06:06 PM
» Replies: 1
» Views: 474
|
reliable Gimp 2.10.38 dow...
Forum: Older Gimp versions (2.8, 2.6....)
Last Post: denzjos
09-13-2025, 05:20 PM
» Replies: 2
» Views: 376
|
Batch Color Saturation
Forum: Extending the GIMP
Last Post: rich2005
09-13-2025, 07:53 AM
» Replies: 15
» Views: 12,059
|
Photo play-time
Forum: Gallery
Last Post: Ofnuts
09-13-2025, 07:32 AM
» Replies: 24
» Views: 21,894
|
BIMP plugin for GIMP 3.10
Forum: Extending the GIMP
Last Post: firefly
09-12-2025, 11:53 PM
» Replies: 2
» Views: 726
|
pl_stroke_arrows GIMP 3.0...
Forum: Extending the GIMP
Last Post: Scallact
09-12-2025, 04:03 PM
» Replies: 0
» Views: 377
|
|
|
PyAstro3 |
Posted by: KenS. - 04-04-2025, 09:55 AM - Forum: Gimp 2.99 & Gimp 3.0
- No Replies
|
 |
Has anyone heard whether PyAstro3 will be updated to GIMP 3.0. So far unable to find contact address for author. Take care.
|
|
|
Gimp 3 Flatapak Linux PYTHONPATH is empty |
Posted by: silenuznowan - 04-03-2025, 07:46 PM - Forum: Scripting questions
- Replies (6)
|
 |
I'm trying to get a bash script to run after changing folders.
If I explicitly set the path to the python scripts it runs fine.
If I however omit the explicit path, even though the scripts are in my PYTHONPATH they are not recognized when running without
explicitly using sys.path.append
If I try and get the python path from inside the Gimp shell, it reports no key present instead of printing the PYTHONPATH like it does when not in the Gimp shell.
As stated in the title I have the flatpak version so my question is how do I get it to use my current PYTHONPATH?
Also is it possible to use packages, and if so how. I had a simple package, but when functions were called from a bash script, they would fail with the internal imports in the package failing. An example is below:
Code:
### This should be the command to start Gimp
GIMP_THREE='flatpak run --user org.gimp.GIMP'
# Start gimp with python-fu batch-interpreter
$GIMP_THREE -i --batch-interpreter=python-fu-eval -b - << EOF
import os
import sys
print("PYTHONPATH = " + os.environ['PYTHONPATH'])
EOF
exit(0)
However if on the command line I load a python script that calls the same methods as the bash script it executes fine.
Code:
flatpak run --user org.gimp.GIMP -i --batch-interpreter=python-fu-eval -b 'import sys; sys.path=["."]+sys.path;import pytest;pytest.run()'
I feel like it's something simple i'm missing because I'm not a python programmer. Hopefully someone can help.
Thanks.
|
|
|
Converting the API doc to Python |
Posted by: Ofnuts - 04-03-2025, 09:11 AM - Forum: Tutorials and tips
- No Replies
|
 |
A little bit of C.
In C you have two kinds of data types.
- The "native" ones: int and floats of various lengths, and pointers (memory addresses)
- The "complex" ones (anything else, "structs" or arrays)
When you call a function:
- native types are passed "by value": their value is copied in the call stack
- complex types are passed "by reference": a pointer to them is copied in the calls stack. The fact that this is a pointer is indicated by *
- the function can only "return" a single native type
- the function can also update memory locations to which a pointer has been passed, this is how extra return values can be used
In addition:
- Except for constructors, in the C description the first argument of a class method is an object of the class
- When used with Python object syntax, this first argument becomes the object on which the method is called (with of course, one less argument).
- So for instance the method described in the doc as do_something(SomeClass, arg1, arg2) is called in Python as instance_of_SomeClass.do_something(arg1,arg2)
For instance with this "C" prototype from the Gimp.Drawable description:
Code:
gboolean
gimp_drawable_get_offsets (
GimpDrawable* drawable,
gint* offset_x,
gint* offset_y
)
Where GimpDrawable is a "complex" type, and gboolean and gint are "native" type (just names for machine-size integers).
* the function returns a boolean
* the first argument is a pointer/reference to GimpDrawable. Since GimpDrawable is a complex type it is a simple "input" argument.
* as stated above, since this is a method on Gimp.Drawable in python it will be called on the object which is the first argument.
* offset_x and offset_y are references to native types, and so are outputs to the function. In Python your inputs are immutable, so this is converted to extra return values, and the method returns a tuple.
So this would be called as:
boolean_success, offset_x,offset_y= get_offsets(layer: Gimp.Drawable)
But since the first argument is of the type described, in Python this method call on a Gimp.Drawable object, so it is passed implicitly when calling the method.
boolean_success, offset_x,offset_y= layer.get_offsets()
The returned boolean here is a bit artificial. This is probably because the method has to use output arguments to return X and Y, so this is the only way to check that the memory locations passed for the offsets have been updated. This can still be ignored in the vast majority of cases by writing:
_, offset_x,offset_y= layer.get_offsets()
where _ is the Python convention to indicate that you don't really care about this value.
Slightly harder:
Code:
GimpLayer*
gimp_image_get_layer_by_name (
GimpImage* image,
const gchar* name
)
- The function takes a reference to a GimpImage, so in this case this is the implicit reference to the object on which the method is called.
- The function takes a reference to gchar. This isn't an output for a single char, this is a reference to an array of characterss (arrays and pointer are equivalent in C, an array is defined by the address of its first element). And an array of gchar is... a string. What also indicates that this is an input-only argument is the const modifier.
- The call returns a pointer to a GimpLayer, so in Python, a plain Gimp.Layer
So this defines a Gimp.Image method that would be type-hinted as:
def get_layer_by_name(name: str) -> Gimp.Layer
Raising the bar:
Code:
GimpLayer **
gimp_image_get_selected_layers (
GimpImage* image
)
Here the call return a pointer to a pointer to GimpLayer... this is really a pointer to an array of GimpLayer, so for Python just a list of Gimp.Layer. So this is just:
def get_selected_layers() -> list[Gimp.Layer]
Gotcha:
Note that some calls are defined as functions and not as object methods. For instance:
Code:
gboolean
gimp_file_save (
GimpRunMode run_mode,
GimpImage* image,
GFile* file,
GimpExportOptions* options
)
This is a plain function in the Gimp namespace that takes 4 explicit arguments.
|
|
|
gimp don't let me dock color tab above tabs right side |
Posted by: strongtower1 - 04-02-2025, 11:30 PM - Forum: Gimp 2.99 & Gimp 3.0
- Replies (2)
|
 |
Hi everyone , I'm using Gimp 3.0.2-1 ( converted to Photogimp) and happens that when the window shows up the software don't let me adjust the window vertically , so....I can't be able to see the options of the lower right side compared to photoshop I'm talking about the another layer, opacity tool, and others. I tried to edit the preferences of window but no results to adjust the window vertically to fit the screen and I can be able to see the lower tools and options. Any recommend will be highly appreciated, my profound thanks in advance.
|
|
|
How to work with effects in GIMP Python? |
Posted by: joeyeroq - 04-02-2025, 09:32 PM - Forum: Scripting questions
- Replies (4)
|
 |
In GIMP 2 you could threshold the alpha channel (Layer > Transparency > Threshold Alpha...), in Python console equivalent was:
Code:
image = gimp.image_list()[0]
layer = image.layers[0]
# image,layer,threshold.
pdb.plug_in_threshold_alpha(image,layer,0)
In GIMP 3 Threshold Alpha has become a filter ("fx" icon next to the layer)
I can do in GIMP 3:
Code:
image = Gimp.get_images()[0]
layer = image.get_selected_layers()[0]
# Add Threshold Alpha layer fx (Layer > Transparency > Threshold Alpha...).
filter1 = Gimp.DrawableFilter.new(layer, 'gimp:threshold-alpha', 'My Threshold Alpha')
# Add Gaussian Blur layer fx (Filters > Blur > Gaussian Blur...).
filter2 = Gimp.DrawableFilter.new(layer, 'gegl:gaussian-blur', 'My Gaussian Blur')
layer.append_filter(filter1)
layer.append_filter(filter2)
But this does the filters in default settings.
How do I change the settings of the filters, for example how do i set the alpha value to 0 of 'My Threshold Alpha'?
|
|
|
GIMP 3.0 crashing |
Posted by: rdoty - 04-02-2025, 08:42 PM - Forum: Gimp 2.99 & Gimp 3.0
- Replies (2)
|
 |
I keep getting the error message "Plug-in crashed: "file-svg.exe". I've reloaded 3.0 but no change. Do I need to delete current program and start over with a new download or is there some easy fix? Thanks in advance.
|
|
|
0xc000007b error |
Posted by: roberts - 04-02-2025, 03:32 PM - Forum: Gimp 2.99 & Gimp 3.0
- Replies (3)
|
 |
Hello,
I installed GIMP 3.02 on a Windows 11 ARM computer.
When launching GIMP, a twain.exe application error window displays "The application could not start correctly error 0xc000007b," then GIMP runs correctly.
Thank you for your help.
Roberts
|
|
|
|