View Single Post
Old 14 April 2011, 05:28   #6
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Been playing with this a bit and have come up with a pretty ok color quantization algorithm.

Basically for each pixel in the image I find the color in the current palette which has the shortest euclidean distance to the color of the current pixel, and move this palette color and the two adjacent colors slightly towards that of the current pixel. It's similar to the NeuQuant algorithm but much simpler and doesn't give as good results. I haven't tried the oct-tree algorithm but it will probably give better results as well.

The images show some tests with the default palette of 32 grays + 6*6*6 colors compared to an adapted palette.
Attached Thumbnails
Click image for larger version

Name:	adaptive_nearest.png
Views:	958
Size:	108.2 KB
ID:	28432   Click image for larger version

Name:	default_50-50.png
Views:	700
Size:	83.3 KB
ID:	28434   Click image for larger version

Name:	adaptive.png
Views:	719
Size:	361.3 KB
ID:	28435   Click image for larger version

Name:	default.png
Views:	682
Size:	228.3 KB
ID:	28436   Click image for larger version

Name:	rgb.png
Views:	1094
Size:	157.9 KB
ID:	28437  

Leffmann is offline  
 
Page generated in 0.04732 seconds with 12 queries