4 ms·
if you jack the minHueCols param up to 4096 or 8192, it does much better in many cases of gradients but also much slower. it's certainly not a complete hands-of
by leeoniya 13y ago
if you jack the minHueCols param up to 4096 or 8192, it does much better in many cases of gradients but also much slower. it's certainly not a complete hands-off quantizer. the best results i've found for 0-config quantizarion is Wu's Color Quantizer v2 [1] implementation [2]
[1] http://www.ece.mcmaster.ca/~xwu/cq.c http://www.ece.mcmaster.ca/~xwu/cq.c
[2] http://nquant.codeplex.com/ http://nquant.codeplex.com/
- pornel 13y agoThere is a version of pngquant that uses Wu's algorithm: https://github.com/pornel/pngquant/tree/wucut https://github.com/pornel/pngquant/tree/wucut However, Wu's algorithm requires preprocessing R * G * B * A * int array, which is 16GB of RAM if done at full RGBA quality, so in practice all implementations have to drop alpha and/or heavily posterize colors. pngquant the same goal — subdivides RGBA (hyper)cube to minimize variance in each section — but does it with much less memory and can do it at full quality. Posterization of input is my pet peeve, as it gives images slightly banded and grainy look that we associate with "256-color" images (since VGA only ever supported 6-bit per gun), and presume 256 colors are never enough for photorealistic look — but it often is, and people who use e.g. TinyPNG service think it's magic.
- leeoniya 13y agoyeah, i discovered how much space it needed when porting it via emscripten to asm.js
- pornel 13y agoIt'd be awesome to port pngquant to JS, especially that JS is getting parallelization and SIMD now. Unfortunately I never got emscripten to work on my machine. Could you give it a try and compile http://pngquant.org/lib http://pngquant.org/lib?
- leeoniya 13y agosure i can give it a go. though i'm currently stuck in an airport going on 14h. i'll ping you when i get around to it but could be a few days
- slashdotaccount 13y agoIMO the best quantisation tools are bright183 (proprietary, by Epic for Unreal shared palettes) and neuquant. Wu unfortunately suffers from banding artifacts very badly for a low amount of colours with dithering off, the banding after applying bright looks much more acceptable. More code to research: http://web.archive.org/web/20041010190217/http://www.geocities.com/SiliconValley/Program/8979/color/index.htm http://web.archive.org/web/20041010190217/http://www.geociti...
- leeoniya 13y agoneuquant is quite good for photos but does strange stuff with graphics and low color counts. in fact, the pool table example that's used to show how good it performs, RgbQuant does better on the details and with fewer artifacts at the expense of bsckground smoothness/banding. compare for yourself http://members.ozemail.com.au/~dekker/NEUQUANT.HTML http://members.ozemail.com.au/~dekker/NEUQUANT.HTML i'll check out bright183