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

   291   2   1
User Avatar
Member
86 posts
Joined: Feb. 2016
Offline
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
Staff
3122 posts
Joined: July 2005
Offline
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
SideFX
www.sidefx.com
User Avatar
Member
86 posts
Joined: Feb. 2016
Offline
Oh I totally missed it.

Thanks a lot for the tips! (-:
  • Quick Links