Skip to content Skip to sidebar Skip to footer

Grabbing Color Palette From Youtube Thumbnail

I'm trying to grab the color palette from YouTube thumbnails, to better blend the YouTube video with a whole website design, and I'm wondering if there is any way of doing this? I'

Solution 1:

Found a solution, but it involves passing the imagelink through http://cors-anywhere.herokuapp.com/

This leaves us with:

var img = newImage();
img.onload = function () {
  var colorThief = newColorThief();
  colorThief.getColor(img);
};
img.crossOrigin = 'Anonymous';
img.src = 'http://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg';

Solution 2:

The best idea is to implement this on the server side, because the most of browsers automatically disable fetching something through javascript from another domain names due to security reasons. That's why you get a CSRF

Post a Comment for "Grabbing Color Palette From Youtube Thumbnail"