It is currently Fri Jun 21, 2024 3:28 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Plugin header files for users
PostPosted: Wed Nov 03, 2021 6:47 pm  (#1) 
Offline
GimpChat Member

Joined: Oct 30, 2021
Posts: 20
Is the plugin framework written for Gimp developers or end users? Here's my beginner experience:

- Find a suitable MingW release for 64 bit Windows. After two trials I ended up with MSYS2.
- Copy the sample from https://wiki.gimp.org/wiki/Hacking:How_ ... MP_plug-in to get started.
- It requires libgimp/gimp.h. This is not included in my Gimp installation.
- I downloaded the Gimp developer source code. It has libgimp/gimp.h
- It requires cairo.h. This is not included. I just commented it out in gimp.h, and 2 more #includes.
- It requires glib.h. This is not part of Gimp. I downloaded the gnome/glib source code.
- It now requires glibconfig.h. This is not part of glib. It appears to be generated but I don't have it.

Should I install the entire Gimp developer installation including its prerequisites and build it from source? Or is there a simpler way. For end users there should be a normal way of writing a plugin, or am I missing something. Thanks in advance for any suggestions!


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Plugin header files for users
PostPosted: Wed Nov 03, 2021 8:04 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Can be downloaded ( https://packages.msys2.org/queue ) - but this is not the latest version (which may cause problems with inappropriate dlls later). Own compilation highly recommended.
How to compile https://wiki.gimp.org/wiki/Hacking:Building/Windows (also not quite up to date).


Attachments:
Search.png
Search.png [ 22.3 KiB | Viewed 2262 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: Plugin header files for users
PostPosted: Wed Nov 03, 2021 11:34 pm  (#3) 
Offline
GimpChat Member

Joined: Oct 30, 2021
Posts: 20
MareroQ wrote:
Can be downloaded ( https://packages.msys2.org/queue ) - but this is not the latest version (which may cause problems with inappropriate dlls later). Own compilation highly recommended.
How to compile https://wiki.gimp.org/wiki/Hacking:Building/Windows (also not quite up to date).


Thanks, that confirms what I suspected: The writing of C plugins is not really meant for regular users, only for experienced developers. With Python it's quite different, anyone can use that with a few lines of code and some simple examples.

I'm not going to do this in C, it's straightforward but it's nuts that this is required for a simple plugin. For what I want to do, I may as well export my image to JPEG, edit it in Scilab to remove the gradient then import it back into Gimp if I need to continue. One alternative is that I use a Python plugin at the top level, let it call a C plugin to Python (not Gimp) that then calls Scilab. This is extra overhead because the images are copied from Gimp to Python to Scilab and back again.

With the extra requirement of needing a Scilab installation it would probably become to unwieldy for others to use it. Otherwise I might put in the effort. Namely, Scilab is significantly easier to use than Python for math so writing advanced image processing features becomes very easy. It would not have the fancy tiling, selection, progress etcetera that other plugins would have so it's probably not a good fit and should stay separate.


Top
 Post subject: Re: Plugin header files for users
PostPosted: Thu Nov 04, 2021 4:18 am  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4750
End users coding in C?

_________________
Image


Top
 Post subject: Re: Plugin header files for users
PostPosted: Thu Nov 04, 2021 7:55 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
And here is another dilemma - Python but which one?
Python2 is deprecated but needed for Gimp-2.10, Python3 is for Gimp 2.99 (dev3.0) which is still under development.
It's worth spending some time compiling the newest Gimp because it's only time consuming (for me 6-8 hours with a slow computer and poor internet connection)...

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Plugin header files for users
PostPosted: Thu Nov 04, 2021 12:50 pm  (#6) 
Offline
GimpChat Member

Joined: Oct 30, 2021
Posts: 20
ofnuts wrote:
End users coding in C?

Oh yeah. There are lots of products that allow end users to write plugins written in C based on a public API. This is mostly in engineering products, which Gimp is IMHO. Cases I'm thinking of are simulation products, OpenCV, finite elements etcetera, all over the place. Gimp does not have a public API for C - you have to compile the entire product and use whatever you can find - though it does for Python.


Top
 Post subject: Re: Plugin header files for users
PostPosted: Thu Nov 04, 2021 1:04 pm  (#7) 
Offline
GimpChat Member

Joined: Oct 30, 2021
Posts: 20
MareroQ wrote:
And here is another dilemma - Python but which one?
Python2 is deprecated but needed for Gimp-2.10, Python3 is for Gimp 2.99 (dev3.0) which is still under development.
It's worth spending some time compiling the newest Gimp because it's only time consuming (for me 6-8 hours with a slow computer and poor internet connection)...

Compiling all of Gimp just to write a plugin is not what users should be doing. There should be a public API and a documented way of building the plugin in a platform independent way. While I could build something that would work for 64 bit Windows, there is no point if someone wants to use it with, say, a Linux 32 bit Scilab distribution. It's practically an unreasonable effort the way things are. Plus of course the Scilab dependency of what I want to do is also not supported though a how-to can be documented, and I don't blame Gimp for that because I don't expect Gimp to support everything any user could want.

I am considering Python. However, besides the Python 2 vs 3 issue, I need a fast matrix multiplication routine (and I don't mean a pointwise one). I think I need numpy for that, and that is not included in the Gimp Python distro. So then I would need to write a C plugin to Python in order to do this fast enough, but that again is a platform dependent build for C plugins to Python not supported by Gimp AFAIK. Writing a matrix multiplication using Python loops is almost certainly too slow. Besides that I need a QR and Givens transform that should be manageable in Python for my case but in general this involves Python loops, which generally should be avoided, and written in C. If Gimp supports numpy please let me know but I think it just supports what is ships, which does not include numpy.

I may try this in Python but I am almost certain that it will be too slow. If the next round of Gimp development would have support for Anaconda 2 and/or 3, that would solve a lot of problems and make it possible for Python plugins to leverage numpy and scipy.


Top
 Post subject: Re: Plugin header files for users
PostPosted: Thu Nov 04, 2021 4:30 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4750
Quote:
There should be a public API and a documented way of building the plugin in a platform independent way


If the plugin is a binary with native code, it will be platform dependent (unless you want Gimp to come with its own loader/linker, and therefore with its own link editor/librarian).

1) https://www.wiki.gimp.org/wiki/Hacking: ... umentation
2) https://www.gimp-forum.net/Thread-Gimp-python-and-numpy

_________________
Image


Top
 Post subject: Re: Plugin header files for users
PostPosted: Fri Nov 05, 2021 5:48 pm  (#9) 
Offline
GimpChat Member

Joined: Oct 30, 2021
Posts: 20
ofnuts wrote:
Quote:
There should be a public API and a documented way of building the plugin in a platform independent way


If the plugin is a binary with native code, it will be platform dependent (unless you want Gimp to come with its own loader/linker, and therefore with its own link editor/librarian).

1) https://www.wiki.gimp.org/wiki/Hacking: ... umentation
2) https://www.gimp-forum.net/Thread-Gimp-python-and-numpy


I understand. I was thinking about an end-user friendly way of being able to build from source across platforms, like how Gimp itself is built on a Unix platform for all platforms (IIRC).

Thank you all for the replies.

For me the most realistic solution is to use Python and call Scilab from it. There is a SourceForge project Sciscipy that provides the Python to Scilab interface for various data types. This plugin comes with build instructions for all platforms and was last updated 8 years ago so Gimp's Python 2.7 must be OK to use.

My status so far: I was able to get a sample Python plugin for Gimp working, and a C to Scilab interface for 32 and 64 bit. I won't use the latter because of all the problems mentioned. Instead I will try to get the sciscipy interface working then see how it all plays together.


Top
 Post subject: Re: Plugin header files for users
PostPosted: Fri Nov 12, 2021 10:58 am  (#10) 
Offline
GimpChat Member

Joined: Oct 30, 2021
Posts: 20
Update: As it turns out, I was able to achieve my goals with native Gimp using wavelets. Gradient removal can be done quite well by selecting all nebulosity to black, then using the wavelet error layer maybe wigh base 7, followed by a wide Gaussian blur. Minimizing the stars using Erode works much better when first selecting all stars perhaps widened by a few pixels. That way the rectangular blobs that show up with non selected Erode are not created. To select the stars, again wavelets are helpful. By selecting the error layer plus base 6 and 7 perhaps base 5 of the original image then subtracted, an image with mostly stars remains that allows for Threshold selection. For the details please go to the Gimp forum where I posted a tutorial on how this works. I went there during the weird blackout period when apparently the host site had not been paid or something.


Top
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Cutout Effect - Gegl plugin for Windows 64bit users

2

No new posts Attachment(s) Donut Text plugin yummy delicious! (Update for non-English users)

4

No new posts Attachment(s) Character sprite sheet creation plugin from files?

4

No new posts For samj 2.10.14 users

4

No new posts Attachment(s) Users' Paths

2



* Login  



Powered by phpBB3 © phpBB Group