Anybody has worked with color quantization / posterizing before?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
pgimeno
Party member
Posts: 3641
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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.
User avatar
pgimeno
Party member
Posts: 3641
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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.
RNavega
Party member
Posts: 341
Joined: Sun Aug 16, 2020 1:28 pm

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

Post 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.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests