Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ofn-gradient-along-path, Greyscale, Speed
#1
Using ofn-gradient-along-path on a particular RGB image takes about 30 minutes.  Using it on the same image converted to Greyscale takes about 90 minutes.  I would like to figure out a way to speed up the script.
Is there a way to profile the script and find out what calls are taking the most time?
Perhaps the image or aspects of it are being converted back and forth between RGB and Greyscale.  Is there some sort of specific Greyscale library or functions which can avoid thrashing like that?
Any suggestions on how I might be able to approach this problem?
Reply
#2
The core loop in OGAP is just stroking paths. But stroking a path on a big image takes a long time. It has been found that making a rough selection of the vicinity around the path can speed things up quite a bit.

This said OGAP is slow by design, since it will stroke the path many times (and double that if there is transparency in the gradient).
Reply
#3
(03-03-2023, 04:01 PM)Ofnuts Wrote: The core loop in OGAP is just stroking paths. But stroking a path on a big image takes a long time. It has been found that making a rough selection of the vicinity around the path can speed things up quite a bit.

This said OGAP is slow by design, since it will stroke the path many times (and double that if there is transparency in the gradient).

Thank you for the response and the selection trick.  I have a big image, and am selecting away half of any stroke.  I am really wondering about the effect of greyscale vs RGB on the stroke process.  Based on the effects in ofn-gradient-along-path, it seems like greyscale strokes take longer than RGB strokes.  I was wondering if there is a way to avoid that slow down either by calling a different stroke procedure, or calling it in a different way.  I realize it might not be possible.
Reply
#4
My timings stroking a 50px wide gradient with OGAP in a 5000x5000 image:

* 8-bit RGB: 43 seconds
* 8-bit Grayscale: 30 after painting a selection among the path with the brush (which seems instantaneous): 

Similar times using 32-bit FP...
Reply
#5
Your test inspired me to test again. I created a 2000 x 2000 image. To create a path, I selected everything and did selection to path. My gradient was the default black to white color options. The gradient width was 500 px.
* Mode RGB (8 bit / sRGB precision): 3:18
* Mode Greyscale (8 bit / sRGB precision): 6:31
The differences in our tests make me think that I must have something off. I don't know what that would be.
Reply
#6
Very same settings; 3.68 seconds in RGB, 3.12 in grayscale... For 5000x000, 10.82 and 9.66. So grayscale is always faster for me.
Reply
#7
(03-04-2023, 07:47 AM)Ofnuts Wrote: For 5000x000, .../...

5000x000? 000=zero, typo? Wink
Reply


Forum Jump: