Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 4,944
» Latest member: Nafeesa
» Forum threads: 7,703
» Forum posts: 41,889

Full Statistics

Latest Threads
Problem with Gimp 3 Pytho...
Forum: Scripting questions
Last Post: Ofnuts
2 hours ago
» Replies: 6
» Views: 197
New to Gimp
Forum: General questions
Last Post: denzjos
Today, 08:20 AM
» Replies: 4
» Views: 257
Autopano Giga 4.4.2 now f...
Forum: Other graphics software
Last Post: denzjos
Today, 08:17 AM
» Replies: 1
» Views: 116
"Mouseclick" is not recor...
Forum: General questions
Last Post: ESH
Yesterday, 10:12 PM
» Replies: 4
» Views: 340
GIMP 2.10 or 3 stuck load...
Forum: General questions
Last Post: theelf
11-15-2025, 05:09 PM
» Replies: 5
» Views: 338
What exactly tutorials ar...
Forum: General questions
Last Post: rich2005
11-15-2025, 12:34 PM
» Replies: 3
» Views: 268
Avatar not showing up
Forum: Gimp-Forum.net
Last Post: Ofnuts
11-15-2025, 08:49 AM
» Replies: 8
» Views: 4,189
Simulating paint my hous...
Forum: General questions
Last Post: sallyanne
11-15-2025, 12:22 AM
» Replies: 1
» Views: 202
Edits Saving wrong
Forum: General questions
Last Post: PaulM
11-14-2025, 10:36 PM
» Replies: 6
» Views: 387
Random Clone
Forum: General questions
Last Post: rich2005
11-14-2025, 07:20 PM
» Replies: 1
» Views: 190

 
  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.

Print this item

  Fill tool not fully filling
Posted by: GluePot - 04-03-2025, 11:37 PM - Forum: General questions - Replies (3)

Hi. I'm attaching an image of what happens after I fuzzy select a selection and then fill that with the foreground color. I have fill settings to 100% opacity. Any idea why it would not only not be opaque, but it's leaving a blur outside of the selection. Thank you.

   

Print this item

  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.

Print this item

  nikgimp - a NikCollection plugin for GIMP3
Posted by: iiey - 04-03-2025, 12:05 PM - Forum: Extending the GIMP - Replies (3)

There is another related thread Rewrite shellout.py to GIMP3, which is more Q&A/troubleshooting oriented.
For the sake of completeness, it might be worth briefly introducing the plugin here.

For any interest, details can be found here:
https://iiey.github.io/nikgimp

Print this item

  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.

Print this item

  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.

Print this item

  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'?
   

Print this item

  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.

Print this item

  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

Print this item

  Version 3 seems to have installation issues.
Posted by: brianleach - 04-02-2025, 11:46 AM - Forum: Windows - Replies (3)

Still on Windows 10 and have had no issues with previous GIMP versions.

However versions of 3 have an issue.

The installation appears to have no issues and on completion asks you if you wish to start the program. You say yes and the interface for version 3 opens with no problem. However (whether you pin it to the taskbar or not) on closing it cannot be opened again as it has been installed and defaults to the exe for the previous version.

Foolishly I thought if I uninstalled that version a new 3 would be set up but there appears to be no way to say where the new version would be located so it fails.

In the App Data there are separate folders for each version but I cannot find an exe file.

I have therefore had to reinstall an earlier version and the latest download I could find is 2.8.22 although I am sure I had perhaps 2.10. 

What am I doing wrong please.

Print this item