Page 2 of 2

Re: Anybody has worked with color quantization / posterizing before?

Posted: Thu Jul 18, 2024 2:29 am
by pgimeno
BrotSagtMist wrote: Wed Jul 17, 2024 5:56 pm Dude, OP asked for posterizing and i gave an example that replicates gimps posterizing tool (minus being a shade off because math.ceil is unfit for this but whatevs).
Maybe you should actually run the code and compare it with an actual graphics tool before throwing a tantrum next time?
apendix: math.floor(r*k+.5)/k will replicate the exact gimp function, while k being off by 1 tho.
Again, have you tried your own code? Note that mapPixel receives integer values 0-255, not floating point values 0-1.

And the OP mentioned quantization/posterizing, but the text of his post implied he was talking about quantization only.

Re: Anybody has worked with color quantization / posterizing before?

Posted: Thu Jul 18, 2024 6:11 pm
by pgimeno
pgimeno wrote: Thu Jul 18, 2024 2:29 am Again, have you tried your own code? Note that mapPixel receives integer values 0-255, not floating point values 0-1.
Apologies, I was running it with love 0.10. In 11.x the range is 0-1 and it works as a kind of per-component posterization.

Re: Anybody has worked with color quantization / posterizing before?

Posted: Fri Jul 19, 2024 3:05 am
by RNavega
SelfDevTv wrote: Mon Jul 15, 2024 7:41 pm In javascript i did that before with a library but I can't find any in love / lua.
So I tried myself for days now with the k-means algorithm, but it just doesn't work.
Can you post your broken implementation of K-means color quantization? If it's fixed, you're golden.