Git Product home page Git Product logo

atcq's People

Contributors

mattdesl 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

atcq's Issues

Possible to run in the command line?

This is super cool and I'm excited that you open-sourced it! I'm coming from a python background and I'd like to use the output somehow as a starting point for other programs. Is there a way to call this from the command line so I can script it? I tried using nodejs, but I got stuck trying to require the library properly.

Feel free to close it as this may be out of scope for supporting this use case.

const ATCQ = require('./atcq.js');
var getPixels = require("get-pixels");

var f_image = "./sample_image_small.jpg";

var pixels = getPixels(f_image, function(err, pixels) {
    if(err) {
	console.log("Bad image path")
	return;
    }
    console.log("got pixels", pixels)    
    
    const palette = ATCQ.quantizeSync(pixels, {
	maxColors: 32
    }); 
    console.log(palette);    
});

Which gave:

nodejs demo.js
got pixels View3dbuffer {
  data: <Buffer fe f9 f1 ff fe f9 ef ff fe f9 ef ff fc fa ed ff fd fb ee ff fe fc f1 ff fe fc f3 ff fd fb f2 ff fb fb ef ff fb fb ef ff fb fb f1 ff fb fb f1 ff fb fb ... >,
  shape: [ 200, 284, 4 ],
  stride: [ 4, 800, 1 ],
  offset: 0 }
/home/hoppeta/projects/palette/atcq/atcq.js:16
  atcq.quantize();
       ^

TypeError: atcq.quantize is not a function
    at Function.quantizeSync (/home/hoppeta/projects/palette/atcq/atcq.js:16:8)
    at /home/hoppeta/projects/palette/atcq/demo.js:19:26
    at handleJPEG (/home/hoppeta/projects/palette/atcq/node_modules/get-pixels/node-pixels.js:44:3)
    at doParse (/home/hoppeta/projects/palette/atcq/node_modules/get-pixels/node-pixels.js:114:7)
    at /home/hoppeta/projects/palette/atcq/node_modules/get-pixels/node-pixels.js:190:7
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

Pathological inputs take extremely long to compute

I'm using the library to generate a palette for every image in a movie. For most images with a diverse palette the computation time is 4-5 seconds. However, for images with very little variation, like the credits at the end of a movie, the computation can take a minute or more. Is there a way to shortcut the algorithm if it can't build a proper palette?

>> time nodejs extract.js baboon.png 

real	0m4.877s
user	0m5.145s
sys	0m0.102s

>> time nodejs extract.js 00000000.jpg 
[{"weight":1,"hex":"#000000","R":0,"G":0,"B":0}]

real	1m41.776s
user	1m36.971s
sys	0m0.092s

The input image is attached here, the worst-case scenario for an all black screen

00000000

Experimenting with maxColors or targetColors doesn't seem to make a difference in the output.

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.