[python] Color gradient sampling from images like in Substance Designer?

   101   1   0
User Avatar
23 posts
Joined: Feb. 2016
I post it here because it could be an interesting idea for a Python tutorial. And I'd love to see more python tutorials. (-:

SD has a very handy gradient node that lets you to mouse over an external image (being it open on the desktop or on a webpage) to sample its color over time while you drag the cursor over it. It then loads those colors in a gradient ramp.

My level of Python is pretty basic, and this project might be too difficult for me, but why not try anyway?
Could you point me in the right direction, please?
I don't really know how to start.

1) What should I study to implement it?
2) What would be the ideal roadmap/structure for this implementation?

thanks a lot for any input.
Edited by Andr - Aug. 9, 2018 20:29:05
User Avatar
3031 posts
Joined: July 2005
you could look at openCV's ‘lineiterator’
https://docs.opencv.org/2.4/modules/core/doc/drawing_functions.html#lineiterator [docs.opencv.org]

https://stackoverflow.com/questions/32328179/opencv-3-0-python-lineiterator [stackoverflow.com]
Michael Goldfarb | www.odforce.net
Senior Technical Director
  • Quick Links