I've searched for any possible solution for that, but all the answers are not really clear or incomplete.
So, say I have the image uploaded into memory:
image = Image.open('image.jpg')
How do I apply this gradient (#582f91 to #00aeef):

To this image:

So it becomes this:

Thanks ahead.
Just use LinearSegmentedColormap :
# make a cmap
mycm=matplotlib.colors.LinearSegmentedColormap.from_list('',['#582f91', '#00aeef'])
# apply on a canal
imgrad=mycm(image[:,:,0])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With