Lossless color reduction

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, helmut, xnview

User avatar
XnTriq
Moderator & Librarian
Posts: 6387
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Lossless color reduction

Post 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.
User avatar
Themis
Posts: 13
Joined: Mon Mar 21, 2016 3:53 pm

Re: Lossless color reduction

Post 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.
User avatar
XnTriq
Moderator & Librarian
Posts: 6387
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Lossless color reduction

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