Open rmgreenstreet opened 4 years ago
+1, webp images support would be great to add.
Yup! It would be cool if it was supported.
For my part, I use this ColorThief to extract the dominant colors. So, to solve this error, I create a temporary JPG file on which I apply the ColorThief::getColor method, then I delete the temporary file.
$image = imagecreatefromwebp($filename);
imagejpeg($image, $tmp_directory . '/tmp.jpg', 100);
imagedestroy($image);
$color_rgb = ColorThief::getColor($tmp_directory . '/tmp.jpg');
unlink($tmp_directory . '/tmp.jpg');
it doesn't solve the problem but if it can help someone in the future ^^
+1, webp images support would be great to add.
+1, webp images support would be great to add.
+1
I think ultimately this hast little to do with this library and more with: https://github.com/scijs/get-pixels
This library hasn't been updated and is unlikely to ever add webp support.
Which has me believe that unless colorthief switches the underlying library, webp will never be supported
I added WebP to my own fork. I might clean this up later and release it properly. For now, if you quickly want to add webp support add the following to your package.json
and run npm i
"overrides": {
"get-pixels": "git@github.com:gitnik/get-pixels-webp-support.git#a064e683d16fc26d4015882b2058afa359a7d4be"
},
Use at your own risk
Spent a few hours trying to figure out why I always got the error "Image given has not completed loading" and it turns out that the package only works with more traditional image formats like .jpg and .png
This may be a fringe request, but it would be cool if this could work with .webp as well.
If not, it would be nice if the documentation A) Listed more prominently on the NPM/Github readme, and B) Explicitly listed the file types supported.