Questions tagged [color-thief]

Questions about color-thief, a library in JavaScript for extracting the main colors from images.

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

Inconsistency to show thief colours on different pages or even same page

so I have been trying to implememnt clour thief with the help of ChatGPT to get the dominant colour of several images and then display that colour as a shadow below the images. SOmetimes it works, ...
Chris Hechler's user avatar
0 votes
0 answers
76 views

How to fix colorthief not changing bg-color

So I'm making a profile picture uploader because I'm bored. I want it to be like when a user upload a image it extract color from the image using colorthief and change the background-color to the ...
axys's user avatar
  • 1
0 votes
0 answers
80 views

TypeError: Cannot read properties of null (reading 'naturalWidth') when navigating to another page before color thief finishes running

I'm using color thief to get the dominant color of many different images (~200) at the same time. If I try to navigate to another page when color thief is still running I get the error TypeError: ...
MarcusWebDev's user avatar
0 votes
0 answers
30 views

How do I find the dominant color in an image generated by PIL.image.crop()? [duplicate]

I am trying to crop an image using PIL.image.crop() and then determine the most dominant color in the cropped image. I've tried using ColorThief but it will only analyze an image if a path to the ...
nickreitz's user avatar
0 votes
1 answer
606 views

Cant install colorthief

I ran into somewhat of a problem while trying to run npm i colorthief I get many error messages, among them: npm WARN deprecated [email protected]: this library is no longer supported npm WARN ...
Idan Rofeh's user avatar
0 votes
1 answer
338 views

Cannot find module 'colorthief'

I am trying to run colorthief, and I downloaded it from the github repo directly(as npm install -g colorthief or npm istall --save colorthief) did not work. I have colorthief in node_modules, and test....
yunlee's user avatar
  • 79
0 votes
0 answers
363 views

Color Thief does not detect right color

I have this sample code that detects color using color-thief https://jsfiddle.net/spidercode/k6Lumq8y/1/ when I run this, it detects the color which is different in the shade. The color which I am ...
ConfusedDeveloper's user avatar
1 vote
0 answers
440 views

importing ColorThief doesn't work and messes up code

I tried to import ColorThief into my code but I get an error saying Uncaught SyntaxError: Cannot use import statement outside a module I don't know what to do since I just copied the import statement ...
Whooey's user avatar
  • 31
0 votes
1 answer
781 views

Cannot get ColorThief to work correctly in Angular, library methods are not found?

I am trying to use the Library ColorThief(https://lokeshdhakar.com/projects/color-thief/) in an Angular 12 project but have had no success getting it to work. I started by doing $ npm i --save ...
SDotJ's user avatar
  • 11
0 votes
1 answer
492 views

ColorThief.getColor() TypeError: url.indexOf is not a function

I'm trying to use ColorThief in the node.js environment. When invoking ColorThief.getColor() I get the follwing error: TypeError: url.indexOf is not a function The error results from this line of ...
ard_dev's user avatar
0 votes
0 answers
205 views

ColorThief react library not rendering

I'm using ColorThief library in react. Here's my code: import Color from 'color-thief-react'; mappedPopularBooks = Object.keys(popularBooks).map(key => { var book = ...
Chris Hansen's user avatar
  • 7,977
0 votes
1 answer
419 views

Node.js: Why does pure black (#000000) get detected as RGB 4, 4, 4?

I have used node-vibrant, get-image-colors, colorthief, all of them detect #000000 as RGB 4, 4, 4. Image here. Just took a picture of an empty portion of the Command Prompt. The code I've provided ...
user avatar
0 votes
1 answer
669 views

Is there possible way to detect the color by using ColorThief which is uploaded from Dropzone?

I used react-dropzone for image upload and I got “file name” and “preview” for each uploaded item from the dropzone. And I would like to use ColorThief for detecting the uploaded image of colors. ...
Shwe's user avatar
  • 145
1 vote
2 answers
2k views

ColorThief.getColor is not a function

So, i'm trying to get my dominant color from color thief. But i'm constantly getting this error: Here is my code that I took from the official documentation var ColorThief = require('colorthief'); //...
Yorbjörn's user avatar
  • 366
0 votes
0 answers
331 views

Getting a pixel color in fullscreen games using Python

Im a Python beginner trying to get the most dominant color (using the ColorTheif module) from a fullscreen game and outputting the RGB values to a text file. Here is what I've got so far: (not ...
Voltonik Electronics's user avatar
0 votes
2 answers
808 views

Color-Thief Node plugin error: "Image given has not completed loading"

Working in Node/Express, I was trying to get the npm package color-thief to grab the dominant color from an image, and it failed because "image given has not completed loading". The image was, again, ...
R Greenstreet's user avatar
1 vote
0 answers
126 views

How i can specify the number of extracted colors in a image with color-thief javascript library?

I want to extract the color of a photo but extract if is posible 26 color, one color for every alphabet letter for a grapheme-color synesthesia ebook reader experiment. Thanks!
Roberto Chalean's user avatar
0 votes
3 answers
3k views

Get color palette from animated GIF with Python PIL

I'd like to get the color palette of each frame of an animated GIF (I'm using ColorThief to generate color palette from an image). I'm using PIL to save each frame as an image, my problem is that the ...
Gusepo's user avatar
  • 847
-1 votes
1 answer
603 views

Implementation of Lokesh Dhakar's "Color Thief" library results in "Uncaught TypeError: Cannot read property '0' of null"

I am trying to implement Lokesh Dhakar's "Color Thief" library. The expected outcome is to display dominant color and color palette immediately after upload. My assumption is that there is going ...
user1098973's user avatar
4 votes
1 answer
248 views

Apply results on each, keeps overriding

I am using color-thief js to get the color of each image inside a div. I am trying to loop through each and retrieve colors. This works fine. In my console, it shows the colors for each image. I ...
Mando's user avatar
  • 387
1 vote
3 answers
4k views

Using Color Thief Library in React doesn't work

I am struggling to add Color Thief in a react app. I have followed the instruction on github but nothing changes. I have applied the suggestions reporte here and then inserted the scripts inside a ...
Nad G's user avatar
  • 507
2 votes
2 answers
1k views

ColorThief returning wrong dominant color

In my UWP app we have images that users upload and they can be pretty much any size - so when I load these into in an Image control I resize them proportionally so they fit best into our image ...
nzmike's user avatar
  • 578
1 vote
0 answers
74 views

ColorThief library is not producing same colors for a single image on different platforms

ColorThief library is available for Javascript, Java, Android and iOS but it is not producing the same colors for a single image on all 4 platforms.Has anybody faced the same issue with this library?...
Anirudh Sharma's user avatar
1 vote
0 answers
45 views

onload in for loop returning only the last item (JS) [duplicate]

my code goes like this: setTimeout(() => { var colorThief = new ColorThief(); var imgObj = new Image(); var count = 0; for (i = 0; ...
mhw4589's user avatar
  • 39
1 vote
1 answer
266 views

Color Thief Not Changing Background

My first time working with Color Thief and I can't seem to get a background of a div to change its background color after checking the dominant color of an image. Here is the code I'm working with ...
user1356871's user avatar
-1 votes
2 answers
308 views

Colored Shadow by Color Thief

I'm trying to make a shadow of an image using Color Thief (like the image below): I'm trying to make Color Thief detect the color and make the shadow look like the shadow colored by the color that ...
Youssef Elmajbri's user avatar
0 votes
1 answer
811 views

Color-thief.js Cannot read property 'width' of undefined

I'm struggling to make color-thief works, I think that my code is right so, I don't understand if it comes from the color-thief script or mine. Here's my code so far : <!doctype html> <...
jjyoh's user avatar
  • 428
1 vote
0 answers
1k views

Dynamic Color-Thief / Get dominant color

I have a very special problem with color-thief. I'm trying to load some data from my datatable containing a realtive path to a image stored on the same domain. There are about 20 links where I have to ...
Humschi's user avatar
  • 11
0 votes
1 answer
649 views

How to Use Color Thief With UWP

I loading images source from internet and I need this images dominant color. Forexample this image and then found color thief but I cant understand. I using this method but I think it's wrong. ...
EgoistDeveloper's user avatar
2 votes
2 answers
661 views

How to change this javascript code to show a modified image?

I am playing with image color quantization algorithms. I have found this link Color Thief where a javascript (a language that I have never studied) implementation of a modified median cut algorithm is ...
Marco Masci's user avatar
2 votes
2 answers
166 views

Javascript average colour of img displayed on mulitple backgrounds

As you can see below I am trying to write a program that will take the average colour of an image and then display it as the background of the parent class where the img is in. Each image is stored ...
AtomiCookiez's user avatar
0 votes
0 answers
331 views

colourthief.getColorFromUrl error on chrome

I am using this GitHub project: github.com/lokesh/color-thief The aim is to get the overall colour of an image stored internally on the server and set it as the background. I created this test page ...
AtomiCookiez's user avatar
3 votes
1 answer
485 views

This jQuery each() loop keeps returning the last color only (Color Thief)

Using the Color Thief javascript effect, I have written some code that grabs an images dominant color and adjusts the entire theme's color scheme based on the image. This all works well on a single ...
anthonyCam's user avatar
2 votes
1 answer
513 views

Canvas & Color-Thief image index size

I'm using color-thief to analyze the colors of images. I'm using a canvas and getImageData, I'm getting the following error message in the console: Error: Index or size is negative or greater than ...
Yafim Simanovsky's user avatar