question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

where are your docs?

See original GitHub issue

your readme is inconclusive.

var colorThief = new ColorThief()
colorThief.getColor(sourceImage)

What is a sourceImage. Is it a URL, an Element, a File object?

I’ve tried to use this prior to a file upload to determine the color… Note: the following does not work.

$('input[type="file"]').on('change', function (e) {
  var colorThief = new ColorThief()
  var color = colorThief.getColor(e.target.files[0])
})

Do you have any suggestions?

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:7
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
samreavescommented, Jun 18, 2014

Hey @ded , I got this to work. You have to create a new image object prior to calling color thief.

After reading the file as a data URL, the following works.

var image = new Image;
image.src = result;
var colorThief = new ColorThief();
var dominantColor = colorThief.getColor(image);

Again, thanks, @lokesh, for creating this library. Works like magic!

0reactions
soyukacommented, Aug 30, 2014

@ksubileau +1 and this error might also happen when Access-Control-Allow-Origin is denied.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Location - South Salisbury, MD - Your Doc's In
We are located off of Route 13 South next to Bank of America and across from Salisbury University in the old Horner Honda...
Read more >
Find your documents in Windows - Microsoft Support
Search from the taskbar or File Explorer to find your documents. ... Find your files in Windows 11 using one of these methods....
Read more >
How to break in Doc Martens quickly and painlessly
Doc Martens are the hottest boot trend right now, but they can be painful to break in. This ultimate guide will show you...
Read more >
Google Docs: Online Document Editor | Google Workspace
Use Google Docs to create, and collaborate on online documents. Edit together with secure sharing in real-time and from any device.
Read more >
How do I break in my Docs? - Dr Martens
Breaking in your Docs will take time and patience, but everyone goes through it. Read on to discover the ways to make this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found