It is currently Tue Jul 02, 2024 3:23 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Performance of adjusting layers and exporting with Python Fu
PostPosted: Sat Jan 30, 2021 1:24 pm  (#1) 
Offline
GimpChat Member

Joined: Jan 30, 2021
Posts: 5
I've written some Python Fu and I am running GIMP from the command line in background mode. My script opens a PSD, changes the fill color of some solid fill layers, pastes an image into a new layer, and then exports a new composite. All this takes around 8 seconds or so on a beefy Windows gaming laptop using the latest stable GIMP 2.10.22. Maybe half that if I don't paste a new image layer in. This really is fantastic -- I don't know of any other open source tools that could do this so well. But I would love to be able to speed it up 10x. Any thoughts on performance?


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: Performance of adjusting layers and exporting with Python Fu
PostPosted: Sat Jan 30, 2021 3:21 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
Gimp is 'ram dependent' but you are not dealing with image sizes of thousands of layers so it's not an issue. Looks like the process is slow because it's sequential.

Other than optimizing your code (I can't help there) using Gimp in OpenCL mode rather than CPU mode would speed up everything. I don't think OCL is fully implemented in Gimp yet. OCL uses graphics cards (GPU's) to process graphics operations which is a lot faster, especially with more than 1 graphics cards.


Top
 Post subject: Re: Performance of adjusting layers and exporting with Python Fu
PostPosted: Sun Jan 31, 2021 1:33 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
If you're not doing anything with text, make sure your command line includes the -f option to not load fonts.
Similarly the -d to not load brushes, patterns gradients etc might save you some time.


Top
 Post subject: Re: Performance of adjusting layers and exporting with Python Fu
PostPosted: Mon Feb 01, 2021 11:28 am  (#4) 
Offline
GimpChat Member

Joined: Jan 30, 2021
Posts: 5
paynekj wrote:
If you're not doing anything with text, make sure your command line includes the -f option to not load fonts.
Similarly the -d to not load brushes, patterns gradients etc might save you some time.


Thank you I am already doing that with "-ifds" although in the future I will need to be able to use the patterns feature.


Top
 Post subject: Re: Performance of adjusting layers and exporting with Python Fu
PostPosted: Thu Feb 04, 2021 5:50 am  (#5) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
If you start an "empty" Gimp instance then you avoid loading the Gimp code each time.

Alternately, if you want to process several files, you can also provide them as a list (or pass a directory) to a script that will process each in turn. This also avoid reloading Gimp each time.

_________________
Image


Top
 Post subject: Re: Performance of adjusting layers and exporting with Python Fu
PostPosted: Fri Feb 05, 2021 1:43 pm  (#6) 
Offline
GimpChat Member

Joined: Jan 30, 2021
Posts: 5
Thanks I will look into that. I do already have some logging that indicates to me the GIMP startup time is minimal and the time is spent exporting a flattened / composite image.


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Exporting as PSD from Python?

2

No new posts Load As Layers Wire Initialization Error With Python

6

No new posts Color Adjusting Help

1

No new posts Trouble exporting to .psd

2

No new posts Filled path not exporting with fill

4



* Login  



Powered by phpBB3 © phpBB Group