| Welcome, Guest |
You have to register before you can post on our site.
|
| Forum Statistics |
» Members: 5,073
» Latest member: phela063
» Forum threads: 7,787
» Forum posts: 42,298
Full Statistics
|
|
|
| How to get the full path from a GFile |
|
Posted by: nmw01223 - Yesterday, 11:09 AM - Forum: Extending the GIMP
- Replies (9)
|
 |
Development on Windows 11 using python 3 in Gimp 3.0.6.
I can find no way of getting the path from a GFile returned from the parameter setting dialog in a plugin.
A file parameter is created by
Code:
procedure.add_file_argument("src-folder",
"Source folder",
"Location of files to parse",
Gimp.FileChooserAction.CREATE_FOLDER,
False,
None,
GObject.ParamFlags.READWRITE)
The purpose of this is to allow browsing for a directory. It shows up in the plugin dialog as a directory browser, and a directory can be selected.
The parameter is then obtained after the dialog has run as
Code:
src_gfile = config.get_property("src-folder")
This has returned a GFile, not (unfortunately) a string path. The question is, how do I get the path out of the GFile? (I need it because I need to do some manipulations on it).
I've tried various things - src_gfile.get_path() produced nothing (though in another plugin I looked at it clearly did looking at the code, but that may have been on Linux, not Windows). I did find that if in the python console I create a GFile and get the path as
Code:
file = Gio.File.new_for_path("C:\\a\\b\\c")
file.get_path()
I do get the path as 'C:\a\b\c' - but not when it comes from the config as above.
src_gfile.get_uri() does produce the URI as a string, looking something line 'file:\\\C:\a\b\c'. Being a URI, it has the scheme on the from, and I can lose the 'file:\\\' by editing the string, but can't help feeling that is a bodge, certainly not cross platform.
I then found query_info(). So I tried
Code:
file_info = src_gfile.query_info("standard::*", Gio.FileQueryInfoFlags.NONE, None)
file_info.get_display_name()
I do get something back - but it's only the final leaf, ie 'c', not the full path and I can't find any method that does that.
So, basically, I can find no way of tidily get the full path as a string from a GFile. Can anyone help?
|
|
|
| affinity now free |
|
Posted by: denzjos - Yesterday, 09:13 AM - Forum: Other graphics software
- No Replies
|
 |
Canva has released version 3.0.3 of Affinity. The Affinity Suite previously consisted of the paid programs Photo, Designer, and Publisher, which were considered equivalent to Adobe's Photoshop, Illustrator, and InDesign. Starting with version 3.0.0, all applications have been consolidated into a single app, which is offered for free. A free Canva account is required to use the software. Some features, including generative AI, require a Canva Premium subscription. Affinity is available for Windows and macOS; the iOS version is still in development.
https://www.affinity.studio/get-affinity
|
|
|
| Where does python debug output go? |
|
Posted by: nmw01223 - 01-20-2026, 05:36 PM - Forum: Extending the GIMP
- Replies (3)
|
 |
I'm trying to debug a python plugin on gimp 3.0.6 on Windows 11. I can get all the section of code to run in the python console, but nothing turns up in the plugin itself except the specified dialog.
I cannot find out where any message output goes. Is there any way of putting the equivalent of print() statements in the code and having it turn up on a console somewhere? I'm running it from the command line as gimp-3.0.exe --verbose.
|
|
|
| GIMP Window Changes Size on Any Action |
|
Posted by: Jeremy_Ray - 01-18-2026, 06:35 PM - Forum: Linux and other Unixen
- Replies (5)
|
 |
GIMP is 3.0.6, OS is Kubuntu 24.04
Here is how it is supposed to look, crammed into the screen space of my little Cintiq 12WX -
![[Image: gimp-fullscreen-setup.jpg]](https://i.ibb.co/GQ20RqkP/gimp-fullscreen-setup.jpg)
Any action at all causes the main window to shrink down like this -
![[Image: gimp-shrunk-window.jpg]](https://i.ibb.co/Kc8RjCBb/gimp-shrunk-window.jpg)
What could be causing it to do this?
Incidentally, I tried the option to merge the GIMP menu bar with the system menu bar. I then turned it off, which didn't turn it off. I then reset the preferences, which didn't turn it off. I then uninstalled GIMP (using snap, which I installed GIMP with), shut down the computer, turned the computer back on and reinstalled GIMP. That didn't restore the system menu bar either. I don't know if that has anything to do with this problem or not.
Incidentally, the rulers and status bar should be turned off, but they've stuck around anyway.
|
|
|
| 1st plugin attempt - save jpeg question |
|
Posted by: nmw01223 - 01-18-2026, 02:47 PM - Forum: Extending the GIMP
- No Replies
|
 |
I am embarking on my 1st (python) plugin using GIMP 3. I'm a long term (basic) Photoshop user and have a lot of software design experience - but virtually no GIMP experience and zero python experience. So, it's a bit of a learning curve.
What I'm doing is pretty simple, replicating something I used to do with Photoshop using VB (OLE) automation. Basically, a batch process - need to point to a source directory containing images of various types and resolutions (TIF, PSD, JPG etc), then to load them one by one, perform some basic (automatic) changes, and write them out one by one as JPEGs to a different directory.
I've got the basic plugin shell going, with a dialog to select directories etc, define the automatic changes and so on, and it seems to work fine.
I think I can see how to get the source filenames using scandir() imported from os. Now looking at loading the files and writing the JPEGs. I assume I can use Gimp.file_load() to load an image.
But, when one writes a JPEG, there are usually some parameters - the JPEG level for file compression to start with. I cannot see any function for doing that. I found Gimp.file_save(run_mode, image, file, options), but it says options isn't used. I really don't want it to pop up a dialog to set these things.
So my basic questions are, is file_load() the right way to load an image, and how do I save a JPEG setting all necessary parameters programmatically?
|
|
|
|