FabriceCastel / gvcci

color extraction to turn images into 16 color palettes
MIT License
109 stars 6 forks source link

Colours are all wrong & error D: #7

Closed nan0s7 closed 6 years ago

nan0s7 commented 6 years ago

So when I run extract.py I get the following error: Traceback (most recent call last): File "extract.py", line 150, in <module> ansi_colors_unconstrained = pick_n_best_colors(8, improved_centers, dominant_dark, dominant_light, min_dark_contrast, min_light_contrast) File "/home/scott/Projects/gvcci/scoring.py", line 267, in pick_n_best_colors within_bounds = filter_within_bounds(hsl_colors, max_contrast_requirement) File "/home/scott/Projects/gvcci/scoring.py", line 265, in filter_within_bounds return colors[boundary_contrast(colors) >= contrast_threshold] File "/home/scott/Projects/gvcci/scoring.py", line 259, in boundary_contrast return contrast_between_boundaries(colors, dark_boundary, light_boundary, dark_min_contrast, light_min_contrast) File "/home/scott/Projects/gvcci/scoring.py", line 195, in contrast_between_boundaries dark_contrast = contrast_between_all(colors, dark_boundary) File "/home/scott/Projects/gvcci/scoring.py", line 39, in contrast_between_all rl_max = np.max(rl_a, rl_b) File "/usr/lib/python3.5/site-packages/numpy/core/fromnumeric.py", line 2272, in amax out=out, **kwargs) File "/usr/lib/python3.5/site-packages/numpy/core/_methods.py", line 26, in _amax return umr_maximum(a, axis, None, out, keepdims) TypeError: only integer scalar arrays can be converted to a scalar index

So fix that when you can. ;P

Also I have another suggestion, can you reduce the size of the repository as a whole? I assume most of the size is from the pictures and such, but in my opinion ~77 MB is a bit much for most people and their internet connections. One thing you could try is to make a repository for all of the pictures and such (or upload them to a website like imgur) so that's optional for those who want the samples and such.

FabriceCastel commented 6 years ago

Turns out yours truly is an idiot and thought numpy.max and numpy.maximum were aliases.

They're not.

I have no idea why this worked for my local setup (but it did). That said I was able to replicate the error on another setup and fix it. I think I might have avoided it because I had an older version of numpy installed and that masked the problem.

Hosting the screenshots on imgur is a good idea. I think I'll go with that :)

Feel free to re-open if this issue persists (or if the script is still broken). I hope this fixes it because I've made a few solid strides in the core color picking logic that yield improved results ^-^