-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Invalid File Type #10
Comments
Hi @vuongngolg ! I see a few issues:
When using a buffer, you need to specify its mime type: getColors(buffer, 'image/gif').then(colors => {
// `colors` is an array of color objects
}) But you don't have to use a buffer if you don't want to specify the mimetype. You can just pass a fully-qualified filename: const path = require('path')
const getColors = require('get-image-colors')
getColors(path.join(__dirname, 'double-rainbow.png')).then(colors => {
// `colors` is an array of color objects
}) See https://github.com/zeke/get-image-colors#usage for more info. Hope this helps. |
Thanks @zeke I've tried 2 ways as following:
The first way can run into step and log color, but the second way cannot. I don't know why. Could you help me to explain? Anyway, I am applying the first way. Thanks |
Try this: var path = require('path')
var file = path.join(__dirname, '/../resources/uploadData/', '1.png')
console.log(file)
// does that look like the right file path?
getColors(file)
.catch(err => {
throw err
})
.then(color => {
console.log(colors)
}) |
Thanks, I tried exactly the same, but it doesn't work, see comment in line var path = require('path') console.log(file) getColors(file) |
can you drag and drop your png file here? |
Hi,
I have an issue when using getColors, it log error: "Error: Invalid File Type"
I am writing the automation scripts in synchronous style with Chimp.
My scripts is as below:
Please help me where I am wrong? Thanks!
The text was updated successfully, but these errors were encountered: