Page 1 of 1
Lossless color reduction
Posted: Thu Jan 05, 2017 5:30 am
by XnTriq
Paint Shop Pro had/has an option called “
Otimized Octree” for reducing the color depth. In combination with the reduction method “Nearest color”, it's possible to convert 24-bit images with <= 256 colors to 8-bit without compromising quality, because the entries of the generated palette are
exactly the same colors as those of the truecolor original.
When applying this algorhithm to 24-bit images with more than 256 colors, “minimum variance” quantization seems to be used.
- MacTech
- Dr Dobb's
- Cubic & $eeN
- Microsoft Developer Network
- CodeGuru
- CodeProject
Re: Lossless color reduction
Posted: Sun Jan 08, 2017 2:41 pm
by Themis
First of all I report about a bag. When XnView 2.35..2.39 uses libimagequant I cannot disable the dithering, although the lib supports it.
libquant.dll returns file version 2.3.1, although the last version of libimagequant is 2.8.2
I applied libimagequant to 256-colors image and didn't find distortion. Does libimagequant really loses quality?
As for full-color photos, the result is very depend on eyes and monitors. On my monitor I see very good results of libimagequant. Only results of NeuQuant is better.
The results of XnViewMP looks like results of non-optimized median cut algorithm.
Re: Lossless color reduction
Posted: Sun Jan 08, 2017 5:30 pm
by XnTriq
Themis wrote:I applied libimagequant to 256-colors image and didn't find distortion. Does libimagequant really loses quality?
Thanks for pointing this out to me, Themis!
- Convert MSX2_Screen8_palette.png to truecolor and save it as BMP (Windows Bitmap).
- Duplicate the file and convert Copy of MSX2_Screen8_palette.bmp to 256 colors using libimagequant.
- Convert Copy of MSX2_Screen8_palette.bmp back to truecolor.
- Do a binary compare of MSX2_Screen8_palette.png and Copy of MSX2_Screen8_palette.bmp.
Depending on the input file, a few bytes in the header can be different (DPI info?), but the image data is identical.