Quantization to 256 colors

Everything else that doesn't fall into one of the other PB categories.
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Quantization to 256 colors

Post by luis »

I just finished to implement the NeuQuant algorithm for quantization of 24/32 bit images to 256 colors, and I added the ability to run a Floyd Steinberg or Sierra dithering on top of that.

The results are *very* good in my opinion. Maybe not all are interested in 8 bits image nowadays, but they still have their place.

Well, here are some samples of the routines in actions. They are quite cpu intensive, but there are many levels of quality so you should find a compromise. Anyway this is about quality above all.

I still have to optimize some code... and write some comments...

[images removed]

Finished work --> here
Last edited by luis on Tue Nov 03, 2009 4:47 pm, edited 3 times in total.
"Have you tried turning it off and on again ?"
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Quantization to 256 colors, almost finished

Post by Mistrel »

It's amazing what can be done with 8-bit! I'll definitely be following this. Thanks for sharing. :)
Fred
Administrator
Administrator
Posts: 18556
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Quantization to 256 colors, almost finished

Post by Fred »

Hehe, those from the old amiga (AGA) days can remember it well, as long you get 256 colors from a 16 millions color palette, you can do incredible picture with it.
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Quantization to 256 colors, almost finished

Post by luis »

I was always fascinated by these things... probably it's the idea behind it... do a lot with less.

I would say I never saw a palette calculated so well, including in commercial programs like photoshop too.

They can get a comparable result (but in the end I prefer this), only using dithering and other techniques.

This code seem to beat them all in generating the best optimized palette, and this helps a lot later because the dithering has very little work left to do (less color errors to distribute), and this produce a much more pleasing final image.
"Have you tried turning it off and on again ?"
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8453
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Quantization to 256 colors, almost finished

Post by netmaestro »

Good on you luis, I'm looking forward to seeing the code! If it's anything like your other shares it'll be well-written and excellent. Thanks for this :D
BERESHEIT
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Quantization to 256 colors, almost finished

Post by luis »

Thank you for the nice words netmaestro, I hope to wrap it up before the end of the week.

And thank you for sharing so much valuable code ...
"Have you tried turning it off and on again ?"
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Quantization to 256 colors, almost finished

Post by luis »

"Have you tried turning it off and on again ?"
User avatar
idle
Always Here
Always Here
Posts: 6238
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Quantization to 256 colors, almost finished

Post by idle »

wow, really impressive results!
Post Reply