Giter Club home page Giter Club logo

get-image-colors's People

Contributors

carloscuesta avatar ijambro avatar millette avatar p-mcgowan avatar vrumger avatar zeke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

get-image-colors's Issues

No Documentation of Options

Hi Creators,

This app is extremely helpful and works really well. But I am having trouble finding documentation on how I can specify the number of colors I want in my palette.

Can you point me in the direction in the documentation if there is one? If there isn't can y'all write up one?

Thanks.

Unable to perform get image on images of file size more than 4mb.

I was trying to fetch colours of images that are more than 4 mb (aprox). The library gets stuck and does not respond. We finally have to restart the server once this happens.

More Context:

  1. We're using this library on our server side to fetch colour of images uploaded.
  2. It works like a charm on my local system even for images as big as 20-25mb.
  3. However, When running on the live server, once an image more than 4 mb is given, the library crashes.
  4. Our server is on AWS, It's an EC2 instance with 2 cores and 1 gb of ram (T4g micro).

Because this works fine on my local, does it have to do something with the heap size on the server? Is there a possible way to configure my node server to allow more memory (If that is the issue) ?

Error: Marker was not found

So I am trying to loop through an array of image urls to get the average picture's color. When I go to try using a buffer as a picture source, I get an invalid GIF error of some sort. I then try downloading via an axios stream and am able to view the picture after downloading, but get this Marker was not found error...

Error: marker was not found
   at decodeScan (/Users/atechooff/Build/Ideea/Webscraper/node_modules/jpeg-js/lib/decoder.js:324:15)
   at constructor.parse (/Users/atechooff/Build/Ideea/Webscraper/node_modules/jpeg-js/lib/decoder.js:744:29)
   at Object.decode (/Users/atechooff/Build/Ideea/Webscraper/node_modules/jpeg-js/lib/decoder.js:983:11)
   at handleJPEG (/Users/atechooff/Build/Ideea/Webscraper/node_modules/get-pixels/node-pixels.js:32:21)
   at doParse (/Users/atechooff/Build/Ideea/Webscraper/node_modules/get-pixels/node-pixels.js:114:7)
   at /Users/atechooff/Build/Ideea/Webscraper/node_modules/get-pixels/node-pixels.js:190:7
   at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

Here is my code.

let index2 = 0
let interval2 = setInterval(() => {

                downloadImage(images.data[index2].sizes[0].url).then((name) => {
                  console.log('Writting :', objectName, ' to file')

                  getColors(__dirname + '/images/' + name + '.jpg').then(colors => {
                    console.log(colors)
                    if (colors[0]._rgb[2] >= 180) {
                      console.log('found good image!')
                      imageLinks.push(images.data[image].sizes[0].url)
                    }
                  })
                    .catch(err => {
                      console.log("Error! ", err) //This is where I catch the Marker not found error
                    })
                })
                if (++index2 == images.data.length) {
                  console.log('finished looping through images... on to the next array.')
                  clearInterval(interval2)
                }

              }, 1000)

This is my downloadImage function just in case there is something wrong with how im downloading.

const downloadImage = async (url) => {
 let name = uuidv4()
 const writer = fs.createWriteStream(path.resolve(__dirname + ‘/images/’ + name + ‘.jpg’))
 const image = await axios({
   url,
   method: ‘GET’,
   responseType: ‘stream’
 })

 image.data.pipe(writer)

 return new Promise((resolve, reject) => {
   writer.on(‘finish’, resolve(name))
   writer.on(‘error’, reject)
 })
}

Getting back colors that aren't in the image

Hi, I started with this image, it's someone's podcast art: http://static.libsyn.com/p/assets/e/3/f/f/e3ffacb40e9f9ebc/Logo_with_text.jpg

It's a simple graphic that is blue, red, yellow and white. For some reason however, it's giving me back several shades of orange, blue and white (missing yellow and red, don't know where the orange came from):

getColors(filePath).then(colors => {
        const palette = colors.map(color => color.hex());
        res.send({ palette });
      })

"palette": [
        "#fbfbfb",
        "#252c7c",
        "#c37025",
        "#c1b8a3",
        "#d58180"
    ]

Error: Invalid File Type

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:

var buffer = fs.readFileSync(path.join(__dirname, '/../../resources/uploadData/', '1.png'));
getColors(buffer, function(error, colors){
    if (err) throw err; // it doesn't log error
    console.log(buffer); // Log: <Buffer 89 50 4e 47 0d 0a ....>
    console.log(error); // Log "Error: Invalid File Type"
});

Please help me where I am wrong? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.