Skip to content
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

Change how quantize counts colors. #6

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -426,10 +426,15 @@ var MMCQ = (function() {
// inner function to do the iteration

function iter(lh, target) {
var ncolors = 1,
var ncolors = lh.size(),
niters = 0,
vbox;
while (niters < maxIterations) {
if (ncolors >= target) return;
if (niters++ > maxIterations) {
// console.log("infinite loop; perhaps too few pixels!");
return;
}
vbox = lh.pop();
if (!vbox.count()) { /* just put it back */
lh.push(vbox);
@@ -450,11 +455,6 @@ var MMCQ = (function() {
lh.push(vbox2);
ncolors++;
}
if (ncolors >= target) return;
if (niters++ > maxIterations) {
// console.log("infinite loop; perhaps too few pixels!");
return;
}
}
}

@@ -471,7 +471,7 @@ var MMCQ = (function() {
}

// next set - generate the median cuts using the (npix * vol) sorting.
iter(pq2, maxcolors - pq2.size());
iter(pq2, maxcolors);

// calculate the actual colors
var cmap = new CMap();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.