Expand shipped krita with most popular image processing pip libraries

Even though you are able to install external pip packages use of external pip libraries in Python plugins

Though, it might be a pain for plugin maintainer to keep it working with Windows, Linux, Mac, (possibly Android) and any other potential platform that Krita will be shipped. I mean, it is a good workaround, however I am not sure it is a good way for paid plugins where the user will expect easy and flawless install. And 80% will have issues with installation, it is not good.

For that matter maybe it is a good idea to ship pykrita with most popular image processing frameworks such as: NumPy, Pillow, skimage, etc

I know that there are pros an cons in this situation, but still.

Another alternative would be to give plugin developers a mechanism to expand their plugin with packages. Maybe something like ‘required’ section. The developer puts a list of required packages and krita automatically installs them if they needed.

Any thoughts?

1 Like

Does krita not include numpy? I have some interest in mypaint’s Spectral. The developer says it uses numpy arrays. And I also saw the matrix in libmypaint. Does krita have mypaint brushes without numpy?

libmypaint is written in C, so why would it need NumPy?

The conversation here is about plugins development. NumPy is the core of Image Processing in Python.

Can I access functionality of libmypaint from python code?

Maybe through this? But I can promise nothing since I’ve never used it…

import gi
gi.require_version('MyPaint', '1.5')
from gi.repository import MyPaint

print ( "doc=", MyPaint.__doc__ )
print ( "dict=", MyPaint.__dict__ )
print ("dir=", dir(MyPaint))
1 Like

Hm. Interesting. I will check it out.

Well, shipping numpy and mypaint brushes have nothing to do with each other, but if there are libraries people want included with Krita like this (and PIL, probably? Or was that renamed?), then if they promise to help maininging the included libraries for every release, then I would be happy to include them.

3 Likes

I think now people use Pillow? It’s not exactly a new version but like a successor? I don’t quite remember what was the deal with it.

I would also like numpy to be in Krita, I have a one-third done project which uses it. Without it, I’d need to rewrite all the code to Krita-acceptable version if I’d like to make it accessible for normal users and/or on Windows (where installing stuff like that is much harder, even I get annoyed at that).

Having a way to use Krita’s own deeper libraries (like making your own kernel filter or iterators) would have a good potential as well.

2 Likes

Yes. It is exactly a successor. It called Pillow, but inside of a package it is still PIL :slight_smile:

What I have done until now was implement what I need myself with colour math, matrices or trigonometry by hand. Works regardless of supported libraries or good will of others and goes faster. Sounds dumb but because of it I can do tricks that would be unaccessible to me otherwise.

2 Likes

Speaking of NumPy it worth noting that this package will benefit http://numba.pydata.org/
Just having numba installed next to numpy will give significant performance boost, since numpy tries to use it when it detects that numba is installed.

Just in case if NumPy will find its way into krita eventually :slight_smile: