GDQuest / krita-batch-exporter

A Free Krita plugin to batch export layers and groups with maximum flexibility. Scale, trim, export multiple copies of your layers...
GNU General Public License v3.0
313 stars 27 forks source link

Using native QImage instead of Pillow #38

Closed leiserfg closed 4 years ago

leiserfg commented 4 years ago

I saw that you are working in order to add this plugin into Krita, but you are having issues with including Pillow. I was thinking about it and maybe you don't need to, because you can use QImage directly for all the transformations/formats that you are dealing with. The only issue being that QImage does not support Lanczos interpolation, but Lanczos is better for up-scaling, not necessarily for down-scaling (which is the normal use case IMHO). If you wanna go for this way, you can also use Node::thumbnail() from Krita, that will make the scaling faster, because the hard work will be done by Krita (the only problem with it is that it does not up-scale). You can upscale the QImage if required anyway. Adding the Margin can be easily done with a using a bigger image and QPainter to draw the original one.

NathanLovato commented 4 years ago

We used Pillow in part for performances. It's way faster than at least Krita's scale functions. Also, Boudjewin was okay to distribute Pillow with Krita.

If it can work as well as what we have now and remove a dependency, why not! We probably won't work on that soon though, having a lot on our plates right now. But if anyone wants to contribute even a proof of concept, contributions are welcome!

NathanLovato commented 4 years ago

@razcore-art May I ask you if you've tried using QImage instead of Pillow? Just to ensure that it's not something you've tried before and that wouldn't work maybe.

leiserfg commented 4 years ago

I will try to re-implement it with QImage and make a PR if I succeed.

NathanLovato commented 4 years ago

Thanks much!

razcore-rad commented 4 years ago

Closed by #40